<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="no-cache, no-store, must-revalidate" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <meta content="0" http-equiv="Expires"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=8">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <link rel="stylesheet" href="../styles/base.css"/>
    <link rel="stylesheet" href="../styles/common.css"/>
    <link rel="stylesheet" href="../styles/font/iconfont.css"/>
    <link rel="stylesheet" href="../styles/pages/tabs.css"/>
    <link rel="stylesheet" href="../jqueryNicepage/css/layui.css"  media="all">
    <style>
        body{
            background:#ddecf5;
            overflow: hidden;
        }
        #loading{
            left:50%;
            top:150px;
        }
        .rightHeader{
            width:98.46%;
        }
        .tab{
            overflow: hidden;position: absolute;
        }
        .rightTable1{
            margin-top:0px;
            height:40px;
        }
        .tab{
            overflow: hidden;position: absolute;
        }
        .table_tbody_box{
            height: 440px;
            overflow-y: scroll;
        }
        .table_tbody_box tr{
            height:37px;
        }
    </style>

</head>
<body>
<div class="boxContainer">
    <div id="loading">
        <img src='../styles/img/loading.gif' />
    </div>
    <div class="leftSide commonSide" id="leftSide">
        <ul class="tabBox">
            <li class="tabList tabListChecked" data-title="side1"><i class="iconfont">&#xe62c;</i><span class="fontStyle">新增物料</span></li>
            <li class="tabList" data-title="side2"><i class="iconfont">&#xe635;</i><span class="fontStyle">删除物料</span></li>
            <li class="tabList" data-title="side3"><i class="iconfont">&#xe615;</i><span class="fontStyle">替换物料</span></li>
            <li class="tabList" data-title="side4"><i class="iconfont">&#xe606;</i><span class="fontStyle">用量修改</span></li>
            <li class="tabList" data-title="side5"><i class="iconfont">&#xe61d;</i><span class="fontStyle">新增替代料</span></li>
            <li class="tabList" data-title="side6"><i class="iconfont">&#xe676;</i><span class="fontStyle">删除替代料</span></li>
            <li class="tabList" data-title="side7"><i class="iconfont">&#xe68b;</i><span class="fontStyle">更换替代料</span></li>
            <li class="tabList" data-title="side8"><i class="iconfont">&#xe63e;</i><span class="fontStyle">更换主料</span></li>
            <li class="tabList" data-title="side9"><i class="iconfont">&#xe602;</i><span class="fontStyle">主次替换</span></li>
            <!-- add by xucr on 20210125 添加替代料用量修改 -->
            <li class="tabList" data-title="side10"><i class="iconfont">&#xe602;</i><span class="fontStyle">替料用量修改</span></li>
        </ul>
    </div>
    <div class="rightForm commonSide" id="rightForm">
        <div class="bgClassBox">
            <div class="tab side1 tabClass">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="ADDPart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table  cellspacing="0" cellpadding="0" id="" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">
                    <thead class="tableHeader">
                    <tr>
                        <th>序号</th>
                        <th>新增料号</th>
                        <th>状态</th>
                        <th>用量</th>
                        <th>单位</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead>
                </table>
                <div class="table_tbody_box">
                    <table cellspacing="0" cellpadding="0" id="side1" class="rightTable1  ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">
                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>

            </div>
            <div class="tab side2">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="DelPart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>删除料号</th>
                        <th>状态</th>
                        <th>用量</th>
                        <th>单位</th>
                        <th>行号</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>

                    </thead></table>
                <div class="table_tbody_box">
                    <table cellspacing="0" cellpadding="0" id="side2" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 0"  border="1">
                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input id="inputItem" type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <div class="tab side3">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="ReplacePart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader3" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>原料号</th>
                        <th>状态</th>
                        <th>原料号用量</th>
                        <th>单位</th>
                        <th>行号</th>
                        <th>新料号</th>
                        <th>状态</th>
                        <th>新料号用量</th>
                        <th>单位</th>
                        <th>变更后行号</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>

                    </thead></table>
                <div class="table_tbody_box">
                    <table cellspacing="0" cellpadding="0" id="side3" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">
                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <div class="tab side4">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="UpdatePart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader4" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>变更料号</th>
                        <th>状态</th>
                        <th>变更前用量</th>
                        <th>单位</th>
                        <th>行号</th>
                        <th>变更后用量</th>
                        <th>单位</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table  cellspacing="0" cellpadding="0" id="side4" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc" border="1">

                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="tab side5">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="ADDReplcePart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader5" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>主料号</th>
                        <th>状态</th>
                        <th>行号</th>
                        <th>新增代替料料号</th>
                        <th>状态</th>
                        <th>新增代替料用量</th>
                        <th>单位</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table  cellspacing="0" cellpadding="0" id="side5" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">
                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <div class="tab side6">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="DelReplcePart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader6" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>主料号</th>
                        <th>状态</th>
                        <th>行号</th>
                        <th>删除替代料料号</th>
                        <th>状态</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table  cellspacing="0" cellpadding="0" id="side6" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">

                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <div class="tab side7">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="UpdateReplcePart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader7" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>主料号</th>
                        <th>状态</th>
                        <th>行号</th>
                        <th>原替代料料号</th>
                        <th>状态</th>
                        <th>变更前用量</th>
                        <th>单位</th>
                        <th>新替代料料号</th>
                        <th>状态</th>
                        <th>变更后用量</th>
                        <th>单位</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table  cellspacing="0" cellpadding="0" id="side7" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">
                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <div class="tab side8">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="updateAPart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader8" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>原主料料号</th>
                        <th>状态</th>
                        <th>行号</th>
                        <th>变更前用量</th>
                        <th>单位</th>
                        <th>新主料料号</th>
                        <th>状态</th>
                        <th>变更后用量</th>
                        <th>单位</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table  cellspacing="0" cellpadding="0" id="side8" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">

                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <div class="tab side9">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="ReplaceABPart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader9" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>原主料料号</th>
                        <th>状态</th>
                        <th>原主料行号</th>
                        <th>原代替料料号</th>
                        <th>状态</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table  cellspacing="0" id="side9" cellpadding="0" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">

                        <tbody >
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="number"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table></div>
            </div>
            <!-- add by xucr on 20210125 添加替代料用量修改 begin -->
            <div class="tab side10">
                <div class="rightFormBtn"><div class="toExcell" >导出Excel</div><div class="deletHistoryData" data-type="ReplaceABPart">删除</div><div class="closePage">关闭</div><div class="submitMes">提交</div></div>
                <table cellspacing="0" cellpadding="0" id="rightHeader10" class="rightHeader ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc;margin-top: 50px"  border="1">
                    <thead>
                    <tr>
						<th>序号</th>
                        <th>主料号</th>
						<th>行号</th>
                        <th>替代料料号</th>
                        <th>状态</th>
                        <th>变更前用量</th>
                        <th>单位</th>
                        <th>变更后用量</th>
                        <th>受影响对象</th>
                        <th>编辑</th>
                    </tr>
                    </thead></table>
                <div class="table_tbody_box">
                    <table cellspacing="0" id="side10" cellpadding="0" class="rightTable1 ecoTabsTable" style="border-width:1px;border-style:solid;border-color:#ccc"  border="1">
                        <tbody>
                        <tr class="flageFirst">
                            <td class="tabNum serialNum">1</td>
                            <td><input type="text"/></td>
							<td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text"/></td>
							<td><input type="text"/></td>
							<td><input type="text"/></td>
                            <td><input type="text"/></td>
                            <td><input type="text" placeholder=""/></td>
                            <td class="operationIcon"><i title="搜索" class="searchPage iconfont">&#xe683;</i><i title="删除" class="iconfont deleteItem">&#xe6ee;</i><i title="增加一行" class="iconfont addCuloumn">&#xe601;</i></td>
                        </tr>
                        </tbody>
                    </table>
				</div>
            </div>
            <!-- add by xucr on 20210125 添加替代料用量修改 end -->
        </div>
    </div>
</div>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
<script src="../layer/layer.js" charset="utf-8"></script>
<script type="text/javascript" src="../js/constants/formBox.js"></script>
<script type="text/javascript" src="../js/common/utils.js"></script>
<script type="text/javascript" src="../js/common/myAjax.js"></script>
<script type="text/javascript" src="../js/pages/ecotabs/multipleChecks.js"></script>
<script type="text/javascript" src="../js/pages/ecotabs/toExcell.js"></script>
<script type="text/javascript" src="../js/pages/ecotabs/whetherExist.js"></script>
<script>
    window.onload=function(){
        var inputValWhetherExist=[];//用于判断各个变更类型的料号在其他变更类型中是否存在。
        var urlData=getQueryStringByNameTwo("single")?getQueryStringByNameTwo("single"):"";
        window.localStorage.removeItem("dataArr");
        //关闭页面
        $("body").on("click",".closePage",function(){
            layerFn("确定要关闭此页面?",function(){
                //window.open("search.html?oid="+ ecoidUrl);
                window.location.href="about:blank";
                window.opener=null;
                window.open('','_self');
                window.close();
            },"true")
        });
        var allWidth=$(".table_tbody_box")[0].clientWidth;
        $(window).resize(function () {          //当浏览器大小变化时
            setWidth();
        });
        //让头部的宽度和表的宽度相等。
        function setWidth(){
            $(".rightHeader").css({
                "width":allWidth
            })
            $(".rightFormBtn").css({
                "width":allWidth
            })
            $(".table_tbody_box").css({
                "width":allWidth+17
            })
            $(".table_tbody_box").css({
                "height":$(".bgClassBox")[0].clientHeight*0.85
            })
        }
        setWidth();
        var ecoidUrl =getQueryStringByNameTwo("oid")?getQueryStringByNameTwo("oid"):"";
        //单个操作页面，显示上个页面带来的数据，隐藏搜索按钮
        function isSinglePage(self){
            if(urlData!=""&&urlData!=undefined){
                var numx=getQueryStringByNameTwo("num");
                var viewx=getQueryStringByNameTwo("view")
                var valuex=numx+"("+viewx+")";
                if(numx!=""&&numx!=undefined&&valuex!=""&&valuex!=undefined){
                    $(".tab tr td:nth-last-child(2) input").val(valuex);

                }
                $(".tab tr td:nth-last-child(1) .searchPage").remove();
                $(".tab tr td:nth-last-child(1) i").css({
                    width:"50%"
                })
            }else{
            }
        }
        isSinglePage();
        //增加一行
        $("body").on("click", ".addCuloumn", function() {
            var self=this;
            addCuloumnFn(self)

        })
        function addCuloumnFn(that,dataValue){
            var tab=$(that).parents(".tab")[0];
            var tbody=$(tab).find('tbody tr:nth-child(1) td');
            var tr=creatTr(tbody);
            $(tab).find('tbody').append(tr);
           // var self=$(tr).find("td:nth-last-child(2) input")[0];
            if(urlData!=""&&urlData!=undefined){
                var numx=getQueryStringByNameTwo("num");
                var viewx=getQueryStringByNameTwo("view")
                var valuex=numx+"("+viewx+")";
                if(numx!=""&&numx!=undefined&&valuex!=""&&valuex!=undefined){
                    $(".tab tr td:nth-last-child(2) input").val(valuex);
                }
                $(".tab tr td:nth-last-child(1) .searchPage").remove();
                $(".tab tr td:nth-last-child(1) i").css({
                    width:"50%"
                })
            }
            var ids=$(that).parents("table").attr("id");
            serialNum("#"+ids);
            $(that).remove();
        }
        //一键删除整个变更类型
        //tmDeleteECOChangeDetail
        $(".deletHistoryData").click(function(){
            var operatetype=$(this).attr("data-type");
            var that=this;
            var type=urlData=="true"?0:1;
            var num=getQueryStringByNameTwo("num")!==""&&getQueryStringByNameTwo("num")!==undefined?getQueryStringByNameTwo("num"):"";
            num=encodeURIComponent(num)
            var view=getQueryStringByNameTwo("view");
            var econumber=getQueryStringByNameTwo("econumber")!=undefined?getQueryStringByNameTwo("econumber"):"";
            var datas="oid="+ecoidUrl+"&effectnumber="+num+"&changetype="+operatetype+"&ecotype="+type+"&view="+view+"&econumber="+econumber;
            deleteTips("确定删除此行变更操作?",function(){
                var side=$(".tabListChecked").attr("data-title");
                /*$("#"+side).load(location.href + " #"+side);
                 $("#"+side).find("table").remove();*/

                historyCheck(side,inputValWhetherExist,function(str){
                    if(str.length>0){
                        for(var sv=0;sv< str.length;sv++){
                            inputValWhetherExist.push(str[sv])
                        }
                    }
                },'del');

                for(var i=0;i<$("#"+side).find("tbody tr").length;i++){
                    if(i!=0){
                        $("#"+side).find("tbody tr").eq(i).empty().attr("class","noEle");
                    }
                }
                $("#"+side).find("tbody .noEle").remove();
                /*for(var i=0;i<$("#"+side).find("tbody tr").length;i++){
                    //if(i!=0){
                        var oTd=$("#"+side).find("tbody tr").eq(i).find("td");
                    if(oTd.length==0){

                    }
                    //}
                }*/
                //$("#"+side).find("tbody tr").not("#"+side+" tbody .flageFirst").remove();
                var isAddCuloumn=$("#"+side).find("tbody tr:first-child td:last-child").find(".addCuloumn");
                if(isAddCuloumn!=undefined&&isAddCuloumn.length>0){
                    //$("#"+side).find("tbody tr:first-child td:last-child").append('<i title="增加一行" class="iconfont addCuloumn">&#xe601;</i>')
                }else{
                    $("#"+side).find("tbody tr:first-child td:last-child").append('<i title="增加一行" class="iconfont addCuloumn">&#xe601;</i>')
                }
                // layerFn("删除成功");
                $("#"+side).find("tbody tr input").val("");
                myAjaxEcoHistory("/tmDeleteECOChangeDetail",datas,function(str){
                    if(str!=undefined&&str){

                    }else{
                        //layerFn("删除失败");
                    }

                })
            })
        })

        //单个操作标识
        var urlData=getQueryStringByNameTwo("single");

        //存储九种变更历史数据
        var listNumArr1=[];
        var listNumArr2=[];
        var listNumArr3=[];
        var listNumArr4=[];
        var listNumArr5=[];
        var listNumArr6=[];
        var listNumArr7=[];
        var listNumArr8=[];
        var listNumArr9=[];
		var listNumArr10 = [];
        //渲染历史数据
        function getHistoryData(operatetype,side){
            $("#loading").css({
                display:"block"
            });
            operatetype=operatetype?operatetype:"ADDPart";
            var type=urlData=="true"?0:1;
            var num=getQueryStringByNameTwo("num")!==""&&getQueryStringByNameTwo("num")!==undefined?getQueryStringByNameTwo("num"):"";
            num=encodeURIComponent(num)
            var view=getQueryStringByNameTwo("view");
            var econumber=getQueryStringByNameTwo("econumber")!=undefined?getQueryStringByNameTwo("econumber"):"";
            var datas="oid="+ecoidUrl+"&effectnumber="+num+"&operatetype="+operatetype+"&type="+type+"&view="+view+"&econumber="+econumber;
            myAjaxEcoHistory("/tmECODataDetail",datas,function(str){
                $("#loading").css({
                    display:"none"
                });
                if(str.result){
                    layerFn(str.result)
                }else{
                    dataLists=str.datalist
                    if(dataLists.length>0){
                        var listArr=[];
                        switch(side){
                            case "#side1":
                                for(var i=0;i<dataLists.length;i++){
                                    var listObj={};
                                    listObj.newAddNum=dataLists[i].newaddnum!=undefined?dataLists[i].newaddnum:"";
                                    listObj.state=dataLists[i].state!=undefined?dataLists[i].state:""
                                    listObj.amount=dataLists[i].amount!=undefined?dataLists[i].amount:"";
                                    listObj.unit=dataLists[i].unit!=undefined?dataLists[i].unit:"";
                                    listObj.effectnumber=dataLists[i].effectnumber+"("+dataLists[i].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr1=listArr;
                                break;
                            case "#side2":
                                for(var a=0;a<dataLists.length;a++){
                                    var listObj={};
                                    listObj.partnumber=dataLists[a].partnumber!=undefined?dataLists[a].partnumber:"";
                                    listObj.state=dataLists[a].state!=undefined?dataLists[a].state:"";
                                    listObj.amount=dataLists[a].amount!=undefined?dataLists[a].amount:"";
                                    listObj.unit=dataLists[a].unit!=undefined?dataLists[a].unit:"";
                                    listObj.linenumber=dataLists[a].linenumber!=undefined?dataLists[a].linenumber:"";
                                    listObj.effectnumber=dataLists[a].effectnumber+"("+dataLists[a].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr2=listArr
                                break;
                            case "#side3":
                                for(var b=0;b<dataLists.length;b++){
                                    var listObj={};
                                    listObj.oldnumber=dataLists[b].oldnumber!=undefined?dataLists[b].oldnumber:"";
                                    listObj.oldstate=dataLists[b].oldstate!=undefined?dataLists[b].oldstate:"";
                                    listObj.oldamount=dataLists[b].oldamount!=undefined?dataLists[b].oldamount:"";
                                    listObj.oldunit=dataLists[b].oldunit!=undefined?dataLists[b].oldunit:"";
                                    listObj.oldlinenumber=dataLists[b].oldlinenumber!=undefined?dataLists[b].oldlinenumber:"";
                                    listObj.newnumber=dataLists[b].newnumber!=undefined?dataLists[b].newnumber:"";
                                    listObj.newstate=dataLists[b].newstate!=undefined?dataLists[b].newstate:"";
                                    listObj.newamount=dataLists[b].newamount!=undefined?dataLists[b].newamount:"";
                                    listObj.newunit=dataLists[b].newunit!=undefined?dataLists[b].newunit:"";
                                    listObj.newlinenumber=dataLists[b].newlinenumber!=undefined?dataLists[b].newlinenumber:"";
                                    listObj.effectnumber=dataLists[b].effectnumber+"("+dataLists[b].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr3=listArr
                                break;
                            case "#side4":
                                for(var d=0;d<dataLists.length;d++){
                                    var listObj={};
                                    listObj.oldnumber=dataLists[d].oldnumber!=undefined?dataLists[d].oldnumber:"";
                                    listObj.oldstate=dataLists[d].oldstate!=undefined?dataLists[d].oldstate:"";
                                    listObj.oldamount=dataLists[d].oldamount!=undefined?dataLists[d].oldamount:"";
                                    listObj.oldunit=dataLists[d].oldunit!=undefined?dataLists[d].oldunit:"";
                                    listObj.oldlinenumber=dataLists[d].oldlinenumber!=undefined?dataLists[d].oldlinenumber:"";
                                    listObj.newamount=dataLists[d].newamount!=undefined?dataLists[d].newamount:"";
                                    listObj.oldunit1=dataLists[d].oldunit!=undefined?dataLists[d].oldunit:"";
                                    listObj.effectnumber=dataLists[d].effectnumber+"("+dataLists[d].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr4=listArr
                                break;
                            case "#side5":
                                for(var et=0;et<dataLists.length;et++){
                                    var listObj={};
                                    listObj.numberA=dataLists[et].numberA!=undefined?dataLists[et].numberA:"";
                                    listObj.stateA=dataLists[et].stateA!=undefined?dataLists[et].stateA:"";
                                    listObj.linenumberA=dataLists[et].linenumberA!=undefined?dataLists[et].linenumberA:"";
                                    listObj.numberB=dataLists[et].numberB!=undefined?dataLists[et].numberB:"";
                                    listObj.stateB=dataLists[et].stateB!=undefined?dataLists[et].stateB:"";
                                    listObj.amountB=dataLists[et].amountB!=undefined?dataLists[et].amountB:"";
                                    listObj.unitB=dataLists[et].unitB!=undefined?dataLists[et].unitB:"";
                                    listObj.effectnumber=dataLists[et].effectnumber+"("+dataLists[et].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr5=listArr
                                break;
                            case "#side6":
                                for(var f=0;f<dataLists.length;f++){
                                    var listObj={};
                                    listObj.numberA=dataLists[f].numberA!=undefined?dataLists[f].numberA:"";
                                    listObj.stateA=dataLists[f].stateA!=undefined?dataLists[f].stateA:"";
                                    listObj.linenumberA=dataLists[f].linenumberA!=undefined?dataLists[f].linenumberA:"";
                                    listObj.numberB=dataLists[f].numberB!=undefined?dataLists[f].numberB:"";
                                    listObj.stateB=dataLists[f].stateB!=undefined?dataLists[f].stateB:"";
                                    listObj.effectnumber=dataLists[f].effectnumber+"("+dataLists[f].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr6=listArr
                                break;
                            case "#side7":
                                for(var g=0;g<dataLists.length;g++){
                                    var listObj={};
                                    listObj.partAnumber=dataLists[g].partAnumber!=undefined?dataLists[g].partAnumber:"";
                                    listObj.partAstate=dataLists[g].partAstate!=undefined?dataLists[g].partAstate:"";
                                    listObj.partAlinenumber=dataLists[g].partAlinenumber!=undefined?dataLists[g].partAlinenumber:"";
                                    listObj.oldpartnumber=dataLists[g].oldpartnumber!=undefined?dataLists[g].oldpartnumber:"";
                                    listObj.oldstate=dataLists[g].oldstate!=undefined?dataLists[g].oldstate:"";
                                    listObj.oldpartamount=dataLists[g].oldpartamount!=undefined?dataLists[g].oldpartamount:"";
                                    listObj.oldunit=dataLists[g].oldunit!=undefined?dataLists[g].oldunit:"";
                                    listObj.newpartnumber=dataLists[g].newpartnumber!=undefined?dataLists[g].newpartnumber:"";
                                    listObj.newstate=dataLists[g].newstate!=undefined?dataLists[g].newstate:"";
                                    listObj.newpartamount=dataLists[g].newpartamount!=undefined?dataLists[g].newpartamount:"";
                                    listObj.newunit=dataLists[g].newunit!=undefined?dataLists[g].newunit:"";
                                    listObj.effectnumber=dataLists[g].effectnumber+"("+dataLists[g].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr7=listArr
                                break;
                            case "#side8":
                                for(var m=0;m<dataLists.length;m++){
                                    var listObj={};
                                    listObj.oldpartnumber=dataLists[m].oldpartnumber!=undefined?dataLists[m].oldpartnumber:"";
                                    listObj.oldstate=dataLists[m].oldstate!=undefined?dataLists[m].oldstate:"";
                                    listObj.oldpartlinenumber=dataLists[m].oldpartlinenumber!=undefined?dataLists[m].oldpartlinenumber:"";
                                    listObj.oldpartamount=dataLists[m].oldpartamount!=undefined?dataLists[m].oldpartamount:"";
                                    listObj.oldunit=dataLists[m].oldunit!=undefined?dataLists[m].oldunit:"";
                                    listObj.newpartnumber=dataLists[m].newpartnumber!=undefined?dataLists[m].newpartnumber:"";
                                    listObj.newstate=dataLists[m].newstate!=undefined?dataLists[m].newstate:"";
                                    listObj.newpartamount=dataLists[m].newpartamount!=undefined?dataLists[m].newpartamount:"";
                                    listObj.newunit=dataLists[m].newunit!=undefined?dataLists[m].newunit:"";
                                    listObj.effectnumber=dataLists[m].effectnumber+"("+dataLists[m].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr8=listArr
                                break;
                            case "#side9":
                                for(var n=0;n<dataLists.length;n++){
                                    var listObj={};
                                    listObj.partANumber=dataLists[n].partANumber!=undefined?dataLists[n].partANumber:"";
                                    listObj.stateA=dataLists[n].stateA!=undefined?dataLists[n].stateA:"";
                                    listObj.linenumber=dataLists[n].linenumber!=undefined?dataLists[n].linenumber:"";
                                    listObj.partBNumber=dataLists[n].partBNumber!=undefined?dataLists[n].partBNumber:"";
                                    listObj.stateB=dataLists[n].stateB!=undefined?dataLists[n].stateB:"";
                                    listObj.effectnumber=dataLists[n].effectnumber+"("+dataLists[n].view+")";
                                    listArr.push(listObj);
                                }
                                listNumArr9=listArr
                                break;
							//add by xucr on 20210125 添加替代料用量修改
							case "#side10":
								//alert("提示1");
								for(var o = 0; o < dataLists.length; o++) {
									var listObj = {};
									listObj.mainNum=dataLists[o].mainNum!=undefined?dataLists[o].mainNum:"";
									//行号
									listObj.mainLineNumber=dataLists[o].mainLineNumber!=undefined?dataLists[o].mainLineNumber:"";
                                    listObj.oldNum=dataLists[o].oldNum!=undefined?dataLists[o].oldNum:"";
                                    listObj.oldState=dataLists[o].oldState!=undefined?dataLists[o].oldState:"";
									//变更前用量、变更后用量、单位
									listObj.oldAmount=dataLists[o].oldAmount!=undefined?dataLists[o].oldAmount:"";
									listObj.unit=dataLists[o].unit!=undefined?dataLists[o].unit:"";
									listObj.newamount=dataLists[o].newAmount!=undefined?dataLists[o].newAmount:"";
                                    listObj.effectnumber=dataLists[o].effectNumber+"("+dataLists[o].view+")";
                                    listArr.push(listObj);
								}
								listNumArr10 = listArr;
								break;
                            default:;

                        }
                        var otd=$(side).find("thead tr td");
                        $(side).find("tbody tr:nth-child(1)").remove()
                        for(var j=0;j<listArr.length;j++){
                            if(j==(listArr.length-1)){
                                $(side+" tbody").append(creatTr3(listArr[j]));
                            }else{
                                if(listArr.length==1){
                                    $(side+" tbody").append(creatTr3(listArr[j]));
                                }else{
                                    $(side+" tbody").append(creatTr2(listArr[j]));
                                }

                            }

                        }

                        var $sidex=$(side+" tbody tr");
                        setReadonly();
                        isSinglePage();//单个操作隐藏搜索按钮
                        for(var s=0;s<$sidex.length;s++){
                            var r=s+1;
                            $(side+" tbody tr").eq(s).find("td:nth-child(1)").text(r);
                        }
                        var returnParam=historyCheck(side,inputValWhetherExist);
                        /*,function(str){
                            if(str.length>0){
                                for(var sv=0;sv< str.length;sv++){
                                    inputValWhetherExist.push(str[sv])
                                }
                            }
                        }*/
                        if(returnParam.length>0){
                            var tips="";
                            var newType=returnParam[0].thisType;
                            //todo
                            for(var sn=0;sn<returnParam.length;sn++){
                                var oldline=returnParam[sn].oldLine;
                                var newline=returnParam[sn].thisLine;
                                var oldtype=returnParam[sn].oldtype;
                                for(var L=0;L<$("#leftSide li").length;L++){
                                    if(newType==$("#leftSide li").eq(L).attr("data-title")){
                                        var typeText=$("#leftSide li").eq(L).find("span").text();
                                    }
                                    if(oldtype==$("#leftSide li").eq(L).attr("data-title")){
                                        var oldTxt=$("#leftSide li").eq(L).find("span").text();
                                    }

                                }
                                $("#"+newType+" tbody tr").eq(newline*1-1).addClass("errTips")
                                tips+=typeText+"第"+newline+"行在'"+oldTxt+"'中第"+oldline+"行已存在;";
                            }
                            layerFn(tips);

                        }

                    }
                }
            })

        }
        getHistoryData("","#side1");

        //获取tab点击对象 并获取历史数据
        $(".tabList").click(function(e){
            $(".tabList").removeClass("tabListChecked")
            tabDataTit=$(this).attr("data-title");
            var tabDataTitClass="."+tabDataTit;
            $(".tab").removeClass("tabClass");
            $(tabDataTitClass).addClass("tabClass");
            var operatetype="ADDPart";
            var dataLists=[];
            switch(tabDataTit){
                case "side1":
                    if(listNumArr1.length==0){
                        operatetype="ADDPart";
                        getHistoryData(operatetype,"#side1");
                    }
                    break;
                case "side2":
                    if(listNumArr2.length==0){
                        operatetype="DelPart";
                        getHistoryData(operatetype,"#side2");
                    }

                    break;
                case "side3":
                    if(listNumArr3.length==0){
                        operatetype="ReplacePart";
                        getHistoryData(operatetype,"#side3");
                    }

                    break;
                case "side4":
                    operatetype="UpdatePart";
                    if(listNumArr4.length==0){
                        operatetype="UpdatePart";
                        getHistoryData(operatetype,"#side4");
                    }
                    break;
                case "side5":
                    operatetype="ADDReplcePart";
                    if(listNumArr5.length==0){
                        getHistoryData(operatetype,"#side5");
                    }
                    break;
                case "side6":
                    operatetype="DelReplcePart";
                    if(listNumArr6.length==0){
                        getHistoryData(operatetype,"#side6");
                    }
                    break;
                case "side7":
                    operatetype="UpdateReplcePart";
                    if(listNumArr7.length==0){
                        getHistoryData(operatetype,"#side7");
                    }
                    break;
                case "side8":
                    operatetype="updateAPart";
                    if(listNumArr8.length==0){
                        getHistoryData(operatetype,"#side8");
                    }
                    break;
                case "side9":
                    if(listNumArr9.length==0){
                        operatetype="ReplaceABPart";
                        getHistoryData(operatetype,"#side9");
                    }
                    break;
                // add by xucr on 20210125 添加替代料用量修改
                case "side10":
					//alert("提示2");
                	if(listNumArr10.length==0){
                        operatetype="UpdateSubstitutesQuantity";
                        getHistoryData(operatetype,"#side10");
                    }
                	break
                default:;

            }
            serialNum("#"+tabDataTit);
            $(this).addClass("tabListChecked")
        })
        //设置只读和数据类型
        setReadonly();

        //生成序号
        serialNum("#side1");
        //搜索点击跳转搜索页
        $("body").on("click",".searchPage",function(){
            var self=this;
            clearInterval(timer);
            var brother=$(this).siblings(".addCuloumn")[0];
            var data = $(this).parents("tr")[0];
            var tab=$(this).parents("table")[0];
            // var urlData1={};
            $(data).attr("data-flage","true");
            var tabsid=$(tab).attr("id");
            var urldataList="" ;
            if(tabsid=="side1"){
                urldataList=$(data).find("td:nth-last-child(2) input").val();
                if(urldataList == "" || urldataList == undefined){
                	urldataList=$(data).find("td:nth-child(2) input").val();
                }
                urldataList=splitMes(urldataList);
            }else{
                urldataList=$(data).find("td:nth-child(2) input").val();
                if(urldataList == "" || urldataList == undefined){
                	 urldataList=$(data).find("td:nth-last-child(2) input").val();
                }
            }

            if(urldataList!=""&&urldataList!=undefined){
                window.open("batchQuery.html?urldataList="+urldataList+"&oid="+ecoidUrl);
            }else{
                window.open("batchQuery.html?oid="+ecoidUrl);
            }
            var defaultValx=$(data).find("input:first-child").val();
            if(tabsid=="side1"||tabsid=="side2"||tabsid=="side4"){
                defaultValx=$(data).find("input:first-child").val();
            }
            defaultValx=defaultValx.replace(/(^\s*)|(\s*$)/g, "");
            var secondVal=""
            if(tabsid=="side3"||tabsid=="side8"){
                secondVal=$(data).find("td:nth-child(7) input").val();
            }else if(tabsid=="side5"||tabsid=="side6"||tabsid=="side7"||tabsid=="side9"){
                secondVal=$(data).find("td:nth-child(5) input").val();
            }
            secondVal=secondVal.replace(/(^\s*)|(\s*$)/g, "");
            var side7Three="";
            if(tabsid=="side7"){
                side7Three=$(data).find("td:nth-child(9) input").val();
            }
            side7Three=side7Three.replace(/(^\s*)|(\s*$)/g, "");
            var timer=setInterval(function(){
                var impacData=localStorage.getItem("dataArr");
                if(impacData!=""&&impacData!=undefined){
                    var effList=impacData.split(",");
                    var jyArr=[];
                    if(effList.length>0){
                        for(var ch=0;ch<effList.length;ch++){
                            var effMs=impacSplit(effList[ch]);
                            jyArr.push(effMs);
                        }
                        renderData(jyArr);
                        //render搜索回来的数据
                        function renderData(rightData){
                            if(rightData.length>0){
                                var otrLen=$(tab).find("tr");
                                var $DataLen = $(data).find('td');
                                var rowList=[];
                                for(var i=0;i<rightData.length;i++){
                                    var rowlistObj={
                                        effectnumber:rightData[i].effectnumber,
                                        view:rightData[i].view
                                    }
                                    if(tabsid=="side1"){
                                        rowlistObj.newaddnum=$(data).find("td:nth-child(2) input").val();
                                        rowlistObj.amount="";
                                    }else if(tabsid=="side2"){
                                        rowlistObj.partnumber=defaultValx;
                                        rowlistObj.amount="";
                                        rowlistObj.linenumber="";
                                    }else if(tabsid=="side3"){
                                       // rowlistObj.rowNmuber=$(data).find("td:first-child").text();
                                        rowlistObj.oldnumber=defaultValx;
                                        rowlistObj.newnumber=secondVal;
                                        rowlistObj.oldamount="";
                                        rowlistObj.oldlinenumber="";
                                        rowlistObj.newamount="";
                                        rowlistObj.newlinenumber="";
                                        //var newPartName=$(data).find("input:first-child+input+input+input").val();
                                    }else if(tabsid=="side4"){
                                        rowlistObj.oldnumber=defaultValx;
                                        rowlistObj.oldamount="";
                                        rowlistObj.oldlinenumber="";
                                        rowlistObj.newamount="";
                                    }else if(tabsid=="side5"){
                                        rowlistObj.numberA=defaultValx;
                                        rowlistObj.linenumberA="";
                                        rowlistObj.numberB=secondVal;
                                        rowlistObj.amountB="";
                                        rowlistObj.linenumberB="";
                                    }else if(tabsid=="side6"){
                                        rowlistObj.numberA=defaultValx;
                                        rowlistObj.numberB= secondVal;
                                        rowlistObj.linenumberA="";
                                    }else if(tabsid=="side7"){
                                        rowlistObj.partAnumber= defaultValx;
                                        rowlistObj.partAlinenumber="";
                                        rowlistObj.oldpartnumber= secondVal;
                                        rowlistObj.oldpartamount="";
                                        rowlistObj.newpartnumber=side7Three;
                                        rowlistObj.newpartamount="";
                                    }else if(tabsid=="side8"){
                                        rowlistObj.oldpartnumber=defaultValx;
                                        rowlistObj.oldpartamount="";
                                        rowlistObj.oldpartlinenumber="";
                                        rowlistObj.newpartnumber=secondVal;
                                        rowlistObj.newpartamount="";
                                    }else if(tabsid=="side9"){
                                        rowlistObj.partANumber=defaultValx;
                                        rowlistObj.partBNumber=secondVal;
                                        rowlistObj.linenumber="";
                                    }
                                    //add by xucr on 20210125 添加替代料用量修改
                                    else if(tabsid == "side10") {
                                    	//alert("提示3"); 从测试来看，暂时未确认此段代码的用途，不写也暂未报错
										rowlistObj.mainNum = defaultValx;
                                    }
                                    rowList.push(rowlistObj);
                                    if(i==0){
                                        var effectnumber=rightData[0].effectnumber+"("+rightData[0].view+")";
                                        $(data).find("td:nth-last-child(2) input").val(effectnumber);
                                        if(rightData.length>1){
                                            for(var oI=0;oI<otrLen.length;oI++){
                                                var otr1=$(otrLen[oI]).find("td:nth-child(2) input").val();
                                                var otr2=$(otrLen[oI]).find("td:nth-last-child(2) input").val()
                                                if(otr1==""&&otr2==""){
                                                    $(otrLen[oI]).remove();
                                                }
                                            }
                                        }
                                    }else{
                                        $(tab).find(" .addCuloumn").empty();
                                        $(data).find("td:nth-last-child(1) .addCuloumn").remove();
                                        var effectnumber=rightData[i].effectnumber+"("+rightData[i].view+")";
                                        if(i==(rightData.length-1)){
                                            var otr=creatTr12($DataLen,effectnumber,defaultValx,secondVal,side7Three,tabsid)
                                        }else{
                                            var otr=creatTr1($DataLen,effectnumber,defaultValx,secondVal,side7Three,tabsid)
                                        }
                                        $(tab).find("tbody").append(otr);

                                    }
                                }
                                var rowNmu=parseInt($(data).find("td:first-child").text());
                                for(var k=0;k<rowList.length;k++){
                                    var lineNum=k+rowNmu;
                                    rowList[k]["rowNmuber"]=lineNum;
                                    rowList[k]["ecoid"]=ecoidUrl
                                }
                                if(tabsid=="side1"||tabsid=="side2"||tabsid=="side4"){
                                    if(defaultValx!=""){
                                        changeCheck($(data).find("input:first-child"),rowList);
                                    }
                                }else{
                                    if(defaultValx!=""&&secondVal!=""&&tabsid!="side7"){
                                        multipleChecks($(data).find("input:first-child"),rowList);
                                    }else if(defaultValx!=""&&secondVal!=""&&side7Three!=""&&tabsid=="side7"){
                                        multipleChecks($(data).find("input:first-child"),rowList);
                                    }else{
                                        //$(data).find("input:first-child").val();
                                        if($(data).find("input:first-child").val()!=""){
                                            changeCheck($(data).find("input:first-child"));
                                        }
                                    }

                                }

                            }
                            serialNum("#"+$(tab).attr("id"));
                        }

                    }
                    defaultValx="";
                    window.localStorage.removeItem("dataArr");//清空缓存数据
                    clearInterval(timer);//清除定时器轮询
                }
            },50)
        })
        //
        $("body").on("focus",".tab tr td:nth-last-child(2) input",function(){
            var data = $(this).parents("tr")[0];
            var dataV=$(data).attr("data-flage")?$(data).attr("data-flage"):"";
            if(dataV!=""){
                $(data).attr("data-flage","");
            }
        })
        //删除一行数据
        $("body").on("click",".deleteItem",function(){
            var otbody=$(this).parents("tbody")[0];
            var id=$($(this).parents("table")[0]).attr("id");
            var len = $(otbody).find("tr").length;
            var that=this;
            if(len>1){
                deleteTips("确定删除此行变更操作?",function(){
                    var otr=$(that).parents("tr")[0];
                    deleCheck(otr,id,inputValWhetherExist,"true");
                    otbody.removeChild(otr);
                    serialNum("#"+id);
                    var addItem=$(otbody).find("tr:nth-last-child(1) .addCuloumn");
                    if(addItem.length>0){
                        $(otbody).find("tr:nth-last-child(1) .addCuloumn").empty();
                        var i="<i title='增加一行' class='iconfont addCuloumn'>&#xe601;</i>"
                        $(otbody).find("tr:nth-last-child(1) td:nth-last-child(1)").append(i);
                    }else{
                        var i="<i title='增加一行' class='iconfont addCuloumn'>&#xe601;</i>"
                        var otd=$(otbody).find("tr:nth-last-child(1) td:nth-last-child(1)");
                        otd.append(i);
                    }
                });

            }else{
                layerFn("最后一行不可删除");
                var oInputLen=$(otbody).find("tr input");


                if(getQueryStringByNameTwo("single")=="true"){
                    for(var len=0;len<oInputLen.length;len++){
                        if(len==(oInputLen.length-1)){

                        }else{
                            $(oInputLen).eq(len).val("")
                        }

                    }
                }else{
                    $(otbody).find("tr input").val("")
                }
                $(otbody).find("tr").removeClass("errTips");
                return;
            }

        })
        //禁止输入科学计数法
        $('input[type=number]').keypress(function(e) {
            if (!String.fromCharCode(e.keyCode).match(/[0-9\.]/)){
                return false
            }
        });
        /***
         * input change事件 必传参数不为空时校验数据，校验成功回显相应数据，失败提示并高亮
         */
        $(".tab").on("blur","input",function(){
            if($(this).attr("type")=="number"){
                var values = Math.ceil($(this).val());//向上取整 结果为5
                if($(this).val()==""){
                    $(this).val("")
                }
                if(typeof values =="number"){
                }
            }

        })
function changeCheck(that,specialData){
	alert(1);
    var taLen=$(that).parents("tr")[0];
    var otable=$(that).parents("table")[0]
    var side=$(otable).attr("id");
    var data={};
    var url="";
    var changeNum1=$(taLen).find("td:nth-child(2) input").val();
    var changeNum2=$(taLen).find("td:nth-last-child(2) input").val();
    if($(that).attr("type")=="number"){
        var values = Math.ceil($(that).val());
        if($(that).val()==""){
            $(that).val("")//防止用户在中文模式下输入字母
        }
        if(typeof values =="number"){
        }
    }
    var isTrue=whetherExist(that,taLen,inputValWhetherExist,side);
    if(isTrue){
        for(var L=0;L<$("#leftSide li").length;L++){
            if(isTrue==$("#leftSide li").eq(L).attr("data-title")){
                var typeText=$("#leftSide li").eq(L).find("span").text();
                layerFn("您输入的料号在变更类型为'"+typeText+"'的表格中已经存在");
                $(that).val("");
                break;
            }

        }
       /// var typeText=$("#leftSide li").getAttribute("").text();

        //alert(inputValWhetherExist)
    }
    //遍历错误数据行并高亮提示
    function errdataFn(errorsRowArr){
        if(errorsRowArr.length>0){
            var tipsMesg="";
            for(var k=0;k<errorsRowArr.length;k++){
                $("#"+side).find("tr").eq((errorsRowArr[k]-1)).addClass("errTips");
                tipsMesg+="第"+errorsRowArr[k]+"行数据，"
            }
            tipsMesg+="输入的物料号和受影响对象编号相同，或者输入的物料号之间相同。请修改后再进行操作。"
            layerFn(tipsMesg);
        }
    }
    switch (side){
        case "side1":
                if(specialData!=undefined&&specialData.length>0){

                    var errorsRowArr=[];
                    for(var j=0;j<specialData.length;j++){
                        if(specialData[j].newaddnum==specialData[j].effectnumber){
                            errorsRowArr.push(specialData[j].rowNmuber)
                        }
                    }
                    errdataFn(errorsRowArr);
                        var data = {
                            datalist:specialData
                        };
                        var url = "/ECOChange/tmAddCheck";
                        if (url != "") {
                            ajaxNewFn(url, data, function (result) {
                                if (result.result != "" && result.result != undefined) {
                                    layerFn(result.result);
                                    //var tdText=$("#"+side).find("tr");
                                    if (result.errornumber.length > 0) {
                                        for (var i = 0; i < result.errornumber.length; i++) {
                                            var num = result.errornumber[i];
                                            if (num != "") {
                                                num = parseInt(num) - 1;
                                                $("#" + side).find("tr").eq(num).addClass("errTips");
                                            }
                                        }
                                    }
                                    //$("#"+side).find().addClass("errTips");
                                } else {

                                    $("#" + side).find("tr").removeClass("errTips");
                                }
                                if (result.datalist.length > 0) {
                                    for (var m = 0; m < result.datalist.length; m++) {
                                        var rowNmuber = parseInt(result.datalist[m].rowNmuber) - 1;
                                        $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(3) input").val(result.datalist[m].state!=undefined?result.datalist[m].state:"");
                                        $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(5) input").val(result.datalist[m].unit!=undefined?result.datalist[m].unit:"");

                                    }
                                }

                            }, function (err) {

                            })

                        }
                   /* }*/

                }else if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]) {
                var side1Val1 = changeNum1;
                var side1Val2 = changeNum2;
                var side1Val3=$(taLen).find("td:nth-child(4) input").val();
                if(changeNum1==""||changeNum2==""){
                    $($(taLen)[0]).removeClass("errTips");
                }

                if (side1Val1 != "" &&side1Val2!="") {
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data = {
                        datalist: [
                            {
                                "newaddnum": side1Val1,
                                "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                                "ecoid": ecoidUrl,
                                "amount":side1Val3,
                                "effectnumber": effObj.effectnumber,
                                "view": effObj.view
                            }]
                    }
                    var url = "/ECOChange/tmAddCheck";
                    if (url != "") {
                        ajaxNewFn(url, data, function (result) {
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");
                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            }  else {
                                $($(taLen)[0]).removeClass("errTips");
                            }
                            if(result.datalist.length>0){
                                $($(taLen)[0]).find("td:nth-child(3) input").val(result.datalist[0].state!=undefined?result.datalist[0].state:"");
                                $($(taLen)[0]).find("td:nth-child(5) input").val(result.datalist[0].unit!=undefined?result.datalist[0].unit:"");
                            }

                        }, function (err) {

                        })

                    }
                } else {
                    // alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }
            break;
        case "side2":
            if(specialData!=undefined&&specialData.length>0){
                var errorsRowArr=[];
                for(var j=0;j<specialData.length;j++){
                    if(specialData[j].partnumber==specialData[j].effectnumber){
                        errorsRowArr.push(specialData[j].rowNmuber)
                    }
                }
                errdataFn(errorsRowArr);
                //function goAjaxFn(specialData) {
                    var data = {
                        datalist: specialData
                    }
                    var url = "/ECOChange/tmdeleteCheck";
                    if (url != "") {
                        ajaxNewFn(url, data, function (result) {
                            if (result.result != "" && result.result != undefined) {
                                layerFn(result.result);

                            }
                            if (result.errornumber != undefined && result.errornumber.length > 0) {
                                for (var i = 0; i < result.errornumber.length; i++) {
                                    var num = result.errornumber[i];
                                    if (num != "") {
                                        num = parseInt(num) - 1;
                                        $("#" + side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            } else {
                                $("#" + side).find("tr").removeClass("errTips");
                            }

                            if (result.datalist.length > 0) {
                                if (result.datalist.length > 0) {
                                    if (specialData.length > 1) {
                                        var allArr = [];
                                        var oldArr = [];
                                        for (var m = 0; m < result.datalist.length; m++) {
                                            var flag = true;
                                            for (var j = 0; j < allArr.length; j++) {
                                                if (result.datalist[m].rowNmuber == allArr[j].rowNmuber) {
                                                    flag = false;
                                                    oldArr.push(result.datalist[m]);
                                                }
                                                ;
                                            }
                                            ;
                                            if (flag) {
                                                allArr.push(result.datalist[m]);
                                                // result.datalist.splice(m, 1);
                                            }
                                            ;
                                        }
                                        for (var n = 0; n < allArr.length; n++) {
                                            if (allArr[n].rowNmuber != undefined) {
                                                var rowNmuber = parseInt(allArr[n].rowNmuber) - 1;
                                                $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value = allArr[n].state!=undefined?allArr[n].state:"";
                                                $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value = allArr[n].amount!=undefined?allArr[n].amount:"";
                                                $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(5) input")[0].value = allArr[n].unit!=undefined?allArr[n].unit:"";
                                                $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value = allArr[n].linenumber!=undefined?allArr[n].linenumber:"";
                                            }
                                        }
                                        if (oldArr.length > 0) {
                                            for (var k = 0; k < oldArr.length; k++) {
                                                var dataValueObj = {
                                                    partnumber: oldArr[k].partnumber!=undefined?oldArr[k].partnumber:"",
                                                    state: oldArr[k].state!=undefined?oldArr[k].state:"",
                                                    amount: oldArr[k].amount!=undefined?oldArr[k].amount:"",
                                                    unit: oldArr[k].unit!=undefined?oldArr[k].unit:"",
                                                    linenumber: oldArr[k].linenumber!=undefined?oldArr[k].linenumber:"",
                                                    effView: oldArr[k].effectnum+ "(" + oldArr[k].view+ ")"
                                                }
                                                var dataobjArr = [];
                                                for (var v in dataValueObj) {
                                                    dataobjArr.push(dataValueObj[v]);
                                                }
                                                //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                                $("#side2 tbody").append(creatTrMore(dataobjArr));
                                            }
                                        }
                                        var addLen = $("#" + side).find(".addCuloumn");
                                        if (addLen.length > 1) {
                                            $("#" + side).find(".addCuloumn").css("display", "none");
                                            $("#" + side).find("tr:nth-last-child(1) .addCuloumn").css("display", "block");

                                        }
                                    } else if (/*result.errornumber.length==0&&*/specialData.length == 1) {
                                        $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].state!=undefined?result.datalist[0].state:"";
                                        $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].amount!=undefined?result.datalist[0].amount:"";
                                        $(taLen).find("td:nth-child(5) input")[0].value=result.datalist[0].unit!=undefined?result.datalist[0].unit:"";
                                        $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].linenumber!=undefined?result.datalist[0].linenumber:"";
                                        if(result.datalist.length>1){
                                            for(var t=1;t<result.datalist.length;t++){
                                                var dataValueObj={
                                                   /* partnumber:result.datalist[t].partnumber,*/
                                                    partnumber:result.datalist[t].partnumber!=undefined?result.datalist[t].partnumber:"",
                                                    state:result.datalist[t].state!=undefined?result.datalist[t].state:"",
                                                    amount:result.datalist[t].amount!=undefined?result.datalist[t].amount:"",
                                                    unit:result.datalist[t].unit!=undefined?result.datalist[t].unit:"",
                                                    linenumber:result.datalist[t].linenumber!=undefined?result.datalist[t].linenumber:"",
                                                    effView:result.datalist[t].effectnum+"("+result.datalist [t].view+")"
                                                }
                                                var dataobjArr= [];
                                                for(var v in dataValueObj){
                                                    dataobjArr.push(dataValueObj[v])
                                                }
                                                $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                                var addLen=$("#"+side).find(".addCuloumn");
                                                if(addLen.length>1){
                                                    $("#"+side).find(".addCuloumn").css("display","none");
                                                    $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                                }
                                            }

                                        }

                                    //}
                                }
                                    setReadonly();
                                serialNum("#"+side);
                                    singleRemoveSearch();
                            }
                        }

                    }, function (err) {

                    })

                }

            }else if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]) {
                var side2Val1 = changeNum1;
                var side2Val2 = changeNum2;
                //var side2Val3 = $(taLen).find("td:nth-last-child(4) input").val();
                if(changeNum1==""||changeNum2==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if (side2Val1 != "" && side2Val2 != "") {
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data={};
                    if(specialData!=undefined&&specialData.length>0){
                        data = {
                            datalist:specialData
                        }
                    }else{
                        data = {
                            datalist: [
                                {
                                    "partnumber": side2Val1,
                                    "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                                    "ecoid": ecoidUrl,
                                    "linenumber": "",
                                    "effectnumber": effObj.effectnumber,
                                    "view": effObj.view
                                }]
                        }
                    }
                    var url = "/ECOChange/tmdeleteCheck";
                    if (url != "") {
                        if ($(that)[0] == $(taLen).find("td:nth-child(2) input")[0] || $(that)[0] == $(taLen).find("td:nth-last-child(2) input")[0]) {
                            ajaxNewFn(url, data, function (result) {
                                if (result.result != ""&&result.result != undefined) {
                                    layerFn(result.result);
                                    $($(taLen)[0]).addClass("errTips");

                                }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                    for(var i=0;i<result.errornumber.length;i++){
                                        var num=result.errornumber[i];
                                        if(num!=""){
                                            num=parseInt(num)-1;
                                            $("#"+side).find("tr").eq(num).addClass("errTips");
                                        }
                                    }
                                }  else {
                                    $($(taLen)[0]).removeClass("errTips");
                                    var datas = result.datalist?result.datalist:[];
                                    if(datas.length>0){
                                       /* $($(taLen)[0]).find("td:nth-child(3) input")[0].value=datas[0].amount;
                                        $($(taLen)[0]).find("td:nth-child(4) input")[0].value=datas[0].linenumber;*/
                                        $($(taLen)[0]).find("td:nth-child(3) input")[0].value=datas[0].state!=undefined?datas[0].state:"";
                                        $($(taLen)[0]).find("td:nth-child(4) input")[0].value=datas[0].amount!=undefined?datas[0].amount:"";
                                        $($(taLen)[0]).find("td:nth-child(5) input")[0].value=datas[0].unit!=undefined?datas[0].unit:"";
                                        $($(taLen)[0]).find("td:nth-child(6) input")[0].value=datas[0].linenumber!=undefined?datas[0].linenumber:"";
                                        if(datas.length>1){
                                            for(var t=1;t<datas.length;t++){
                                                var dataValueObj={
                                                    partnumber:result.datalist[t].partnumber!=undefined?result.datalist[t].partnumber:"",
                                                    state:result.datalist[t].state!=undefined?result.datalist[t].state:"",
                                                    amount:result.datalist[t].amount!=undefined?result.datalist[t].amount:"",
                                                    unit:result.datalist[t].unit!=undefined?result.datalist[t].unit:"",
                                                    linenumber:result.datalist[t].linenumber!=undefined?result.datalist[t].linenumber:"",
                                                    effView:result.datalist[t].effectnum+"("+result.datalist[t].view+")"
                                                }
                                                var dataobjArr=[];
                                                for(var v in dataValueObj){
                                                    dataobjArr.push(dataValueObj[v])
                                                }
                                                $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                            }
                                            var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                            if(culomnLen.length>0){
                                                for(var m=0;m<culomnLen.length;m++){
                                                    if(m!=(culomnLen.length-1)){
                                                        $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                    }
                                                }
                                            }
                                            setReadonly();
                                            serialNum("#"+side);
                                            singleRemoveSearch();
                                        }
                                    }
                                }

                            }, function (err) {

                            })
                        }
                    }
                } else {
                    //alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }
            break;
        case "side3":
            if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(7) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side3Val1=  changeNum1;
                var side3Val2=  changeNum2;
                var side3Val3=  $(taLen).find("td:nth-child(7) input").val();
                if(changeNum1==""||changeNum2==""||side3Val3){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side3Val1!=""&&side3Val2!=""&&side3Val3!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||side3Val3==changeNum1||side3Val3==effObj.effectnumber){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data={
                        datalist:[{
                            "ecoid":ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "oldnumber":side3Val1,
                            "newnumber":side3Val3,
                            "oldamount":"",
                            "oldlinenumber":"",
                            "newamount":"",
                            "newlinenumber":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view
                        }]
                    }
                    var url="/ECOChange/tmReplaceCheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            } if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            } else {
                                $($(taLen)[0]).removeClass("errTips");
                                var datas=result.datalist?result.datalist:[];
                                if(datas.length>0){
                                   // $(taLen).find("td:nth-child(3) input")[0].value=datas[0].oldamount;
                                    $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].oldstate!=undefined?result.datalist[0].oldstate:"";
                                    $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].oldamount!=undefined?result.datalist[0].oldamount:"";
                                    $(taLen).find("td:nth-child(5) input")[0].value=result.datalist[0].oldunit!=undefined?result.datalist[0].oldunit:"";
                                    $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].oldlinenumber!=undefined?result.datalist[0].oldlinenumber:"";
                                    $(taLen).find("td:nth-child(8) input")[0].value=result.datalist[0].newstate!=undefined?result.datalist[0].newstate:"";
                                    $(taLen).find("td:nth-child(9) input")[0].value=result.datalist[0].oldamount!=undefined?result.datalist[0].oldamount:"";
                                    $(taLen).find("td:nth-child(10) input")[0].value=result.datalist[0].newunit!=undefined?result.datalist[0].newunit:"";
                                    $(taLen).find("td:nth-child(11) input")[0].value=result.datalist[0].newlinenumber!=undefined?result.datalist[0].newlinenumber:"";
                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                oldnumber:datas[t].oldnumber!=undefined?datas[t].oldnumber:"",
                                                oldstate:datas[t].oldstate!=undefined?datas[t].oldstate:"",
                                                oldamount:datas[t].oldamount!=undefined?datas[t].oldamount:"",
                                                oldunit:datas[t].oldunit!=undefined?datas[t].oldunit:"",
                                                oldlinenumber:datas[t].oldlinenumber!=undefined?datas[t].oldlinenumber:"",
                                                newnumber:datas[t].newnumber!=undefined?datas[t].newnumber:"",
                                                newstate:datas[t].newstate!=undefined?datas[t].newstate:"",
                                                newamount:datas[t].oldamount!=undefined?datas[t].oldamount:"",
                                                newunit:datas[t].newunit!=undefined?datas[t].newunit:"",
                                                newlinenumber:datas[t].newlinenumber!=undefined?datas[t].newlinenumber:"",
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        }
                                        var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                        if(culomnLen.length>0){
                                            for(var m=0;m<culomnLen.length;m++){
                                                if(m!=(culomnLen.length-1)){
                                                    $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                }
                                            }
                                        }
                                        setReadonly();
                                        serialNum("#"+side);
                                        singleRemoveSearch();
                                    }

                                }
                            }

                        },function(err){

                        })
                    }
                }else{
                    // alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }


            break;
        case "side4"://用量修改；
            if(specialData!=undefined&&specialData.length>0){
                var errorsRowArr=[];
                for(var j=0;j<specialData.length;j++){
                    if(specialData[j].oldnumber==specialData[j].effectnumber){
                        errorsRowArr.push(specialData[j].rowNmuber)
                    }
                }
                errdataFn(errorsRowArr);
                    var data = {
                        datalist:specialData
                    };
                url = "/ECOChange/dosModificCheck";
                if (url != "") {
                    ajaxNewFn(url, data, function (result) {
                        if (result.result != ""&&result.result != undefined) {
                            layerFn(result.result);

                        }if(result.errornumber!=undefined&&result.errornumber.length>0){
                            for(var i=0;i<result.errornumber.length;i++){
                                var num=result.errornumber[i];
                                if(num!=""){
                                    num=parseInt(num)-1;
                                    $("#"+side).find("tr").eq(num).addClass("errTips");
                                }
                            }
                        } else {
                            $("#"+side).find("tr").removeClass("errTips");
                        }
                        if(result.datalist.length>0){
                            if(specialData.length>1){
                                var allArr=[];
                                var oldArr=[];
                                for(var m=0;m<result.datalist.length;m++){
                                    var flag = true;
                                    for(var j=0;j<allArr.length;j++){
                                        if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                            flag = false;
                                            oldArr.push(result.datalist[m]);
                                        };
                                    };
                                    if(flag){
                                        allArr.push(result.datalist[m]);
                                        //result.datalist.splice(m, 1);
                                    };

                                }
                                for(var n=0;n<allArr.length;n++){
                                    if(allArr[n].rowNmuber!=undefined){
                                        var rowNmuber=parseInt(allArr[n].rowNmuber)-1;
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value=allArr[n].oldstate!=undefined?allArr[n].oldstate:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value=allArr[n].oldamount!=undefined?allArr[n].oldamount:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(5) input")[0].value=allArr[n].oldunit!=undefined?allArr[n].oldunit:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value=allArr[n].oldlinenumber!=undefined?allArr[n].oldlinenumber:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].oldamount!=undefined?allArr[n].oldamount:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].oldunit!=undefined?allArr[n].oldunit:"";
                                    }
                                }
                                if(oldArr.length>0){
                                    for(var k=0;k<oldArr.length;k++){
                                        var dataValueObj={
                                            oldnumber:oldArr[k].oldnumber!=undefined?oldArr[k].oldnumber:"",
                                            oldstate:oldArr[k].oldstate!=undefined?oldArr[k].oldstate:"",
                                            oldamount:oldArr[k].oldamount!=undefined?oldArr[k].oldamount:"",
                                            oldunit:oldArr[k].oldunit!=undefined?oldArr[k].oldunit:"",
                                            oldlinenumber:oldArr[k].oldlinenumber!=undefined?oldArr[k].oldlinenumber:"",
                                            newamount:oldArr[k].oldamount!=undefined?oldArr[k].oldamount:"",
                                            newunit:oldArr[k].oldunit!=undefined?oldArr[k].oldunit:"",
                                            effView:oldArr[k].effectnumber+"("+oldArr[k].view+")"
                                        }
                                        var dataobjArr=[];
                                        for(var v in dataValueObj){
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                        $("#side4 tbody").append(creatTrMore(dataobjArr));
                                        //$("#side4 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }
                                var addLen=$("#"+side).find(".addCuloumn");
                                if(addLen.length>1){
                                    $("#"+side).find(".addCuloumn").css("display","none");
                                    $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                }
                            }else if(result.errornumber.length==0&&specialData.length==1){
                                var datas=result.datalist
                                //for(var m=0;m<datas.length;m++){
                                    $(taLen).find("td:nth-child(3) input")[0].value=datas[0].oldstate!=undefined?datas[0].oldstate:'';
                                    $(taLen).find("td:nth-child(4) input")[0].value=datas[0].oldamount!=undefined?datas[0].oldamount:'';
                                    $(taLen).find("td:nth-child(5) input")[0].value=datas[0].oldunit!=undefined?datas[0].oldunit:'';
                                    $(taLen).find("td:nth-child(6) input")[0].value=datas[0].oldlinenumber!=undefined?datas[0].oldlinenumber:'';
                                    $(taLen).find("td:nth-child(7) input")[0].value=datas[0].oldamount!=undefined?datas[0].oldamount:'';
                                    $(taLen).find("td:nth-child(8) input")[0].value=datas[0].oldunit!=undefined?datas[0].oldunit:'';
                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                oldnumber:datas[t].oldnumber!=undefined?datas[t].oldnumber:'',
                                                oldstate:datas[t].oldstate!=undefined?datas[t].oldstate:'',
                                                oldamount:datas[t].oldamount!=undefined?datas[t].oldamount:'',
                                                oldunit:datas[t].oldunit!=undefined?datas[t].oldunit:'',
                                                oldlinenumber:datas[t].oldlinenumber!=undefined?datas[t].oldlinenumber:'',
                                                newamount:datas[t].oldamount!=undefined?datas[t].oldamount:'',
                                                newunit:datas[t].oldunit!=undefined?datas[t].oldunit:'',
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                            var addLen=$("#"+side).find(".addCuloumn");
                                            if(addLen.length>1){
                                                $("#"+side).find(".addCuloumn").css("display","none");
                                                $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                            }
                                        }

                                    }

                                //}
                            }
                            setReadonly();
                            serialNum("#"+side);
                            singleRemoveSearch();
                        }

                    }, function (err) {

                    })

                }


            }else if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side4Val1=  changeNum1;
                var side4Val2=  changeNum2;
                if(changeNum1==""||changeNum2==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side4Val1!=""&&side4Val2!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data={
                        datalist:[{
                            "ecoid":ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "oldnumber":side4Val1,
                            "oldamount":"",
                            "oldlinenumber":"",
                            "newamount":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view

                        }]
                    }
                    var url="/ECOChange/dosModificCheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){

                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            } else {
                                $($(taLen)[0]).removeClass("errTips");
                                var datas=result.datalist?result.datalist:[];
                                if(datas.length>0){
                                    $(taLen).find("td:nth-child(3) input")[0].value=datas[0].oldstate!=undefined?datas[0].oldstate:'';
                                    $(taLen).find("td:nth-child(4) input")[0].value=datas[0].oldamount!=undefined?datas[0].oldamount:'';
                                    $(taLen).find("td:nth-child(5) input")[0].value=datas[0].oldunit!=undefined?datas[0].oldunit:'';
                                    $(taLen).find("td:nth-child(6) input")[0].value=datas[0].oldlinenumber!=undefined?datas[0].oldlinenumber:'';
                                    $(taLen).find("td:nth-child(7) input")[0].value=datas[0].oldamount!=undefined?datas[0].oldamount:'';
                                    $(taLen).find("td:nth-child(8) input")[0].value=datas[0].oldunit!=undefined?datas[0].oldunit:'';
                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                oldnumber:datas[t].oldnumber!=undefined?datas[t].oldnumber:'',
                                                oldstate:datas[t].oldstate!=undefined?datas[t].oldstate:'',
                                                oldamount:datas[t].oldamount!=undefined?datas[t].oldamount:'',
                                                oldunit:datas[t].oldunit!=undefined?datas[t].oldunit:'',
                                                oldlinenumber:datas[t].oldlinenumber!=undefined?datas[t].oldlinenumber:'',
                                                newamount:datas[t].oldamount!=undefined?datas[t].oldamount:'',
                                                newunit:datas[t].oldunit!=undefined?datas[t].oldunit:'',
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        }
                                        var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                        if(culomnLen.length>0){
                                            for(var m=0;m<culomnLen.length;m++){
                                                if(m!=(culomnLen.length-1)){
                                                    $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                }
                                            }
                                        }
                                        setReadonly();
                                        serialNum("#"+side);
                                        singleRemoveSearch();
                                    }
                                }

                            }


                        },function(err){

                        })
                    }
                }else{
                    /// alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }

            break;
        case "side5"://新增替代料
            if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(5) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side5Val1=  changeNum1;
                var side5Val2=  changeNum2;
                var side5Val4=  $(taLen).find("td:nth-child(5) input").val();
                if(changeNum1==""||changeNum2!=""||side5Val4==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side5Val1!=""&&side5Val2!=""&&side5Val4!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||changeNum1==side5Val4||side5Val4==effObj.effectnumber){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data={
                        datalist:[{
                            "ecoid":ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "numberA":side5Val1,
                            "linenumberA":"",
                            "numberB":side5Val4,
                            "amountB":"",
                            "linenumberB":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view
                        }]
                    }
                    var url="/ECOChange/addReplacePartCheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            }  else {
                                $($(taLen)[0]).removeClass("errTips");
                                var datas=result.datalist?result.datalist:[];
                                if(datas.length>0){
                                    $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].stateA!=undefined?result.datalist[0].stateA:'';
                                    $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].linenumberA!=undefined?result.datalist[0].linenumberA:'';
                                    $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].stateB!=undefined?result.datalist[0].stateB:'';
                                    $(taLen).find("td:nth-child(7) input")[0].value=result.datalist[0].amountB!=undefined?result.datalist[0].amountB:'';
                                    $(taLen).find("td:nth-child(8) input")[0].value=result.datalist[0].unitB!=undefined?result.datalist[0].unitB:'';
                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                numberA:datas[t].numberA!=undefined?datas[t].numberA:'',
                                                stateA:datas[t].stateA!=undefined?datas[t].stateA:'',
                                                linenumberA:datas[t].linenumberA!=undefined?datas[t].linenumberA:'',
                                                numberB:datas[t].numberB!=undefined?datas[t].numberB:'',
                                                stateB:datas[t].stateB!=undefined?datas[t].stateB:'',
                                                amountB:datas[t].amountB?datas[t].amountB:"",
                                                unitB:datas[t].unitB!=undefined?datas[t].unitB:'',
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        }
                                        var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                        if(culomnLen.length>0){
                                            for(var m=0;m<culomnLen.length;m++){
                                                if(m!=(culomnLen.length-1)){
                                                    $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                }
                                            }
                                        }
                                        setReadonly();
                                        serialNum("#"+side);
                                        singleRemoveSearch();
                                    }
                                }

                            }

                        },function(err){

                        })
                    }
                }else{
                    //alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }


            break;
        case "side6"://删除替代料
            if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(5) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side6Val1=  changeNum1;
                var side6Val2=  changeNum2;
                var side6Val4=  $(taLen).find("td:nth-child(5) input").val();
                if(changeNum1==""||changeNum2!=""||side6Val4==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side6Val1!=""&&side6Val2!=""&&side6Val4!="") {
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||side6Val4==effObj.effectnumber||side6Val4==changeNum1){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data = {
                        datalist: [{
                            "ecoid": ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "numberA": side6Val1,
                            "numberB": side6Val4,
                            "linenumberA":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view
                        }]
                    }
                    var url = "/ECOChange/deleteReplacePartCheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            }  else {
                                $($(taLen)[0]).removeClass("errTips");
                                var datas=result.datalist?result.datalist:[];
                                if(datas.length>0){
                                    $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].stateA!=undefined?result.datalist[0].stateA:'';
                                    $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].linenumberA!=undefined?result.datalist[0].linenumberA:'';
                                    $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].stateB!=undefined?result.datalist[0].stateB:'';
                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                numberA:datas[t].numberA!=undefined?datas[t].numberA:'',
                                                stateA:datas[t].stateA!=undefined?datas[t].stateA:'',
                                                linenumberA:datas[t].linenumberA!=undefined?datas[t].linenumberA:'',
                                                numberB:datas[t].numberB!=undefined?datas[t].numberB:'',
                                                stateB:datas[t].stateB!=undefined?datas[t].stateB:'',
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        }
                                        var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                        if(culomnLen.length>0){
                                            for(var m=0;m<culomnLen.length;m++){
                                                if(m!=(culomnLen.length-1)){
                                                    $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                }
                                            }
                                        }
                                        setReadonly();
                                        serialNum("#"+side);
                                        singleRemoveSearch();
                                    }
                                }
                            }

                        },function(err){

                        })
                    }
                } else {
                    // alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }
            break;
        case "side7"://更换替代料
            if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(5) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(9) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side7Val1=  changeNum1;
                var side7Val2=  changeNum2;
                var side7Val4=  $(taLen).find("td:nth-child(5) input").val();
                var side7Val6=  $(taLen).find("td:nth-child(9) input").val();
                if(changeNum1==""||changeNum2!=""||side7Val4==""||side7Val6==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side7Val1!=""&&side7Val2!=""&&side7Val4!=""&&side7Val6!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||side7Val4==effObj.effectnumber||side7Val4==changeNum1||side7Val6==changeNum1||side7Val4==side7Val6||side7Val6==effObj.effectnumber){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data={
                        datalist:[{
                            "ecoid": ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "partAnumber": side7Val1,
                            "partAlinenumber":"",
                            "oldpartnumber": side7Val4,
                            "oldpartamount":"",
                            "newpartnumber":side7Val6,
                            "newpartamount":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view
                        }]

                    }
                    var url="/ECOChange/replaceOldPartCheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            }  else {
                                $($(taLen)[0]).removeClass("errTips");
                                var datas=result.datalist?result.datalist:[];
                                if(datas.length>0){
                                    $(taLen).find("td:nth-child(3) input")[0].value=datas[0].partAstate!=undefined?datas[0].partAstate:'';
                                    $(taLen).find("td:nth-child(4) input")[0].value=datas[0].partAlinenumber!=undefined?datas[0].partAlinenumber:'';
                                    $(taLen).find("td:nth-child(6) input")[0].value=datas[0].oldstate!=undefined?datas[0].oldstate:'';
                                    $(taLen).find("td:nth-child(7) input")[0].value=datas[0].oldpartamount!=undefined?datas[0].oldpartamount:'';
                                    $(taLen).find("td:nth-child(8) input")[0].value=datas[0].oldunit!=undefined?datas[0].oldunit:'';
                                    $(taLen).find("td:nth-child(10) input")[0].value=datas[0].newstate!=undefined?datas[0].newstate:'';
                                    $(taLen).find("td:nth-child(11) input")[0].value=datas[0].newpartamount!=undefined?datas[0].newpartamount:'';
                                    $(taLen).find("td:nth-child(12) input")[0].value=datas[0].newunit!=undefined?datas[0].newunit:'';

                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                partAnumber:datas[t].partAnumber!=undefined?datas[t].partAnumber:'',
                                                partAstate:datas[t].partAstate!=undefined?datas[t].partAstate:'',
                                                partAlinenumber:datas[t].datas[t].partAlinenumber!=undefined?datas[t].partAlinenumber:'',
                                                oldpartnumber:datas[t].oldpartnumber!=undefined?datas[t].oldpartnumber:'',
                                                oldpartamount:datas[t].oldpartamount!=undefined?datas[t].oldpartamount:'',
                                                oldstate:datas[t].oldstate!=undefined?datas[t].oldstate:'',
                                                oldunit:datas[t].oldunit!=undefined?datas[t].oldunit:'',
                                                newpartnumber:datas[t].newpartnumber!=undefined?datas[t].newpartnumber:'',
                                                newstate:datas[t].newstate!=undefined?datas[t].newstate:'',
                                                newpartamount:datas[t].newpartamount!=undefined?datas[t].newpartamount:'',
                                                newunit:datas[t].newunit!=undefined?datas[t].newunit:'',
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        }
                                        var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                        if(culomnLen.length>0){
                                            for(var m=0;m<culomnLen.length;m++){
                                                if(m!=(culomnLen.length-1)){
                                                    $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                }
                                            }
                                        }
                                        setReadonly();
                                        serialNum("#"+side);
                                        singleRemoveSearch();
                                    }
                                }

                            }

                        },function(err){

                        })
                    }
                }else{
                    // alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }

            break;
        case "side8"://更换主料
            if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(7) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side8Val1=  changeNum1;
                var side8Val2=  changeNum2;
                if(changeNum1==""||changeNum2!=""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                var side8Val5=  $(taLen).find("td:nth-child(7) input").val();
                if(side8Val1!=""&&side8Val2!=""&&side8Val5!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||side8Val5==effObj.effectnumber||changeNum1==side8Val5){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                    var data={
                        datalist:[{
                            "ecoid": ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "oldpartnumber":side8Val1,
                            "oldpartamount":"",
                            "oldpartlinenumber":"",
                            "newpartnumber":side8Val5,
                            "newpartamount":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view
                        }]
                    }
                    var url="/ECOChange/repalcePartACheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            }  else {
                                $($(taLen)[0]).removeClass("errTips");
                                var datas=result.datalist?result.datalist:[];
                                if(datas.length>0){
                                    $(taLen).find("td:nth-child(3) input")[0].value=datas[0].oldstate!=undefined?datas[0].oldstate:"";
                                    $(taLen).find("td:nth-child(4) input")[0].value=datas[0].oldpartlinenumber!=undefined?datas[0].oldpartlinenumber:"";
                                    $(taLen).find("td:nth-child(5) input")[0].value=datas[0].oldpartamount!=undefined?datas[0].oldpartamount:"";
                                    $(taLen).find("td:nth-child(6) input")[0].value=datas[0].oldunit!=undefined?datas[0].oldunit:"";
                                    $(taLen).find("td:nth-child(8) input")[0].value=datas[0].newstate!=undefined?datas[0].newstate:"";
                                    $(taLen).find("td:nth-child(9) input")[0].value=datas[0].oldpartamount!=undefined?datas[0].oldpartamount:"";
                                    $(taLen).find("td:nth-child(10) input")[0].value=datas[0].newunit!=undefined?datas[0].newunit:"";
                                    if(datas.length>1){
                                        for(var t=1;t<datas.length;t++){
                                            var dataValueObj={
                                                oldpartnumber:datas[t].oldpartnumber!=undefined?datas[t].oldpartnumber:"",
                                                oldstate:datas[t].oldstate!=undefined?datas[t].oldstate:"",
                                                oldpartlinenumber:datas[t].oldpartlinenumber!=undefined?datas[t].oldpartlinenumber:"",
                                                oldpartamount:datas[t].oldpartamount!=undefined?datas[t].oldpartamount:"",
                                                oldunit:datas[t].oldunit!=undefined?datas[t].oldunit:"",
                                                newpartnumber:datas[t].newpartnumber!=undefined?datas[t].newpartnumber:"",
                                                newstate:datas[t].newstate!=undefined?datas[t].newstate:"",
                                                newpartamount:datas[t].oldpartamount!=undefined?datas[t].oldpartamount:"",
                                                newunit:datas[t].newunit!=undefined?datas[t].newunit:"",
                                                effView:datas[t].effectnumber+"("+datas[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        }
                                        var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                        if(culomnLen.length>0){
                                            for(var m=0;m<culomnLen.length;m++){
                                                if(m!=(culomnLen.length-1)){
                                                    $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                                }
                                            }
                                        }
                                        setReadonly();
                                        serialNum("#"+side);
                                        singleRemoveSearch();

                                    }
                                }

                            }

                        },function(err){

                        })
                    }
                }else{
                    //  alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }
            }

            break;
        case "side9":
            if($(that)[0]==$(taLen).find("td:nth-child(2) input")[0]||$(that)[0]==$(taLen).find("td:nth-child(5) input")[0]||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){
                var side9Val1=  changeNum1;
                var side9Val2=  changeNum2;
                var side9Val3=  $(taLen).find("td:nth-child(5) input").val();
                if(changeNum1==""||changeNum2!=""||side9Val3==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side9Val1!=""&&side9Val2!=""&&side9Val3!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||side9Val3==effObj.effectnumber||changeNum1==side9Val3){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return
                    }
                   var  data={
                        datalist:[{
                            "ecoid": ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "partANumber":side9Val1,
                            "partBNumber":side9Val3,
                            "linenumber":"",
                            "effectnumber": effObj.effectnumber,
                            "view": effObj.view
                        }]
                    }
                    var url="/ECOChange/repalcePartAAndPartBCheck";
                    if(url!=""){
                        ajaxNewFn(url,data,function(result){
                            if (result.result != ""&&result.result != undefined) {
                                layerFn(result.result);
                                $($(taLen)[0]).addClass("errTips");

                            }if(result.errornumber!=undefined&&result.errornumber.length>0){
                                for(var i=0;i<result.errornumber.length;i++){
                                    var num=result.errornumber[i];
                                    if(num!=""){
                                        num=parseInt(num)-1;
                                        $("#"+side).find("tr").eq(num).addClass("errTips");
                                    }
                                }
                            }  else {
                                $($(taLen)[0]).removeClass("errTips");

                            if(result.datalist.length>0){
                                $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].stateA!=undefined?result.datalist[0].stateA:"";
                                $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].linenumber?result.datalist[0].linenumber:"";
                                $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].stateB!=undefined?result.datalist[0].stateB:"";
                                if(result.datalist.length>1){
                                    for(var t=1;t<result.datalist.length;t++){
                                        var dataValueObj={
                                            partANumber:result.datalist[t].partANumber!=undefined?result.datalist[t].partANumber:"",
                                            stateA:result.datalist[t].stateA!=undefined?result.datalist[t].stateA:"",
                                            linenumber:result.datalist[t].linenumber!=undefined?result.datalist[t].linenumber:"",
                                            partBNumber:result.datalist[t].partBNumber!=undefined?result.datalist[t].partBNumber:"",
                                            stateB:result.datalist[t].stateB!=undefined?result.datalist[t].stateB:"",
                                            effView:result.datalist[t].effectnumber+"("+result.datalist[t].view+")"
                                        }
                                        var dataobjArr=[];
                                        for(var v in dataValueObj){
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                    }
                                    var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
                                    if(culomnLen.length>0){
                                        for(var m=0;m<culomnLen.length;m++){
                                            if(m!=(culomnLen.length-1)){
                                                $($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
                                            }
                                        }
                                    }
                                    setReadonly();
                                    serialNum("#"+side);
                                    singleRemoveSearch();

                                }
                            }
                            }

                        },function(err){

                        })
                    }
                }else{
                    // alert("您输入的受影响对象格式不正确，正确格式例如:E0001(A10，C10),E002(B10)")
                }

            }
            break;
        //add by xucr on 20210125 添加替代料用量修改
        case "side10" :
        	//alert("提示4");
			/**if($(that)[0]==$(taLen).find("td:nth-child(4) input")[0]
				||$(that)[0]==$(taLen).find("td:nth-child(5) input")[0]
				||$(that)[0]==$(taLen).find("td:nth-last-child(2) input")[0]){*/
                var side10Val1=  changeNum1; //主料
                var side10Val2=  changeNum2; //受影响对象
                var side10Val3=  $(taLen).find("td:nth-child(4) input").val(); //替代料
				var newAmount =  $(taLen).find("td:nth-child(8) input").val(); //变更后用量
                if(changeNum1==""||changeNum2!=""||side10Val3==""){
                    $($(taLen)[0]).removeClass("errTips");
                }
                if(side10Val1!=""&&side10Val2!=""&&side10Val3!=""){
                    if(changeNum2!=""&&(impacSplit(changeNum2).effectnumber==""||impacSplit(changeNum2).view=="")){
                        layerFn("你输入的受影响对象格式不正确，应为：受影响对象（视图）。例如E12133(A10)");
                        $($(taLen)[0]).addClass("errTips");
                        return
                    }else{
                        $($(taLen)[0]).removeClass("errTips");
                    }
                    var effObj=impacSplit(changeNum2);
                    if(changeNum1==effObj.effectnumber||side10Val3==effObj.effectnumber||changeNum1==side10Val3){
                        $($(taLen)[0]).addClass("errTips");
                        layerFn("输入的物料号不能和受影响对象编号相同或者输入的物料号之间不能相同");
                        return;
                    }
					var data={
						datalist:[{
                            "ecoid": ecoidUrl,
                            "rowNmuber":$($(taLen)[0]).find("td:first-child").text(),
                            "mainNum":side10Val1,
                            "oldNum":side10Val3,
							"newAmount":newAmount,
                            "effectNumber": effObj.effectnumber,
                            "view": effObj.view
                        }]
                    }
                    var url="/ECOChange/addSubstitutesQuantityCheckValidate";
					ajaxNewFn(url,data,function(result){
						var msg = result.msg;
						if (msg != ""&&msg != undefined) {
							layerFn(msg);
							$($(taLen)[0]).addClass("errTips");
						}
						if(result.errornumber!=undefined&&result.errornumber.length>0){
							for(var i=0;i<result.errornumber.length;i++){
								var num=result.errornumber[i];
								if(num!=""){
									num=parseInt(num)-1;
									$("#"+side).find("tr").eq(num).addClass("errTips");
								}
							}
						} else {
							var dataList = result.data;
							$($(taLen)[0]).removeClass("errTips");
							if(dataList.length>0){
								$(taLen).find("td:nth-child(3) input")[0].value=dataList[0].mainLineNumber!=undefined?dataList[0].mainLineNumber:"";
								$(taLen).find("td:nth-child(5) input")[0].value=dataList[0].oldState!=undefined?dataList[0].oldState:"";
								$(taLen).find("td:nth-child(7) input")[0].value=dataList[0].unit!=undefined?dataList[0].unit:"";
								$(taLen).find("td:nth-child(6) input")[0].value=dataList[0].oldAmount!=undefined?dataList[0].oldAmount:"";
								if(dataList.length>1){
									for(var t=1;t<dataList.length;t++){
										var dataValueObj={
											mainNum:dataList[t].mainNum!=undefined?dataList[t].mainNum:"",
											oldNum:dataList[t].oldNum!=undefined?dataList[t].oldNum:"",
											oldState:dataList[t].oldState!=undefined?dataList[t].oldState:"",
											oldAmount:dataList[t].oldAmount!=undefined?dataList[t].oldAmount:"",
											unit:dataList[t].unit!=undefined?dataList[t].unit:"",
											newAmount:dataList[t].newAmount!=undefined?dataList[t].newAmount:"",
											mainLineNumber:dataList[t].mainLineNumber!=undefined?dataList[t].mainLineNumber:"",
											effView:dataList[t].effectNumber+"("+dataList[t].view+")"
										}
										var dataobjArr=[];
										for(var v in dataValueObj){
											dataobjArr.push(dataValueObj[v])
										}
										$($(taLen)[0]).after(creatTrMore(dataobjArr));
									}
									var culomnLen=$($(taLen).parents("tbody").find(".addCuloumn"));
									if(culomnLen.length>0){
										for(var m=0;m<culomnLen.length;m++){
											if(m!=(culomnLen.length-1)){
												$($(taLen).parents("tbody").find(".addCuloumn")).eq(m).empty();
											}
										}
									}
									setReadonly();
									serialNum("#"+side);
									singleRemoveSearch();
								}
							}
						}
					},function(err){

					})
                }
            //}
			break;
    }
    function singleRemoveSearch(){
        if(urlData=="true"){
            $(".ecoTabsTable tr td .searchPage").remove();
            $(".tab tr td:nth-last-child(1) i").css({
                width:"50%"
            })
        }
    }

}

        $(".tab").on("change","input",function(){
            /*var thisVal=$(this).val();
            $(this).val($.trim(thisVal))*/
			//alert("ddd");
            changeCheck(this)
        })

        /**
         * submit事件
         */

        $(".submitMes").click(function(){
            var tips="";
            var side1=$("#side1 tbody tr");
            var datatList1=[];
            var changetype=urlData=="true"?0:1;
            var sameTips="";
            var datatListText1=[];
            for(var i=0;i<side1.length;i++){
                if($("#side1 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("新增物料存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList1=[];
                    return false ;
                }else if($("#side1 tbody tr").eq(i).attr("class")!="errTips"){
                    var addCode=$("#side1 tbody tr").eq(i).find("td:nth-child(2) input").val();
                    var num=$("#side1 tbody tr").eq(i).find("td:nth-child(4) input").val();
                    var impac=$("#side1 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                    if(addCode!=""&&num!=""&&impac!=""){
                        var list=impacSplit(impac)?impacSplit(impac):{};
                        list.newaddnum=addCode;
                        list.amount=num;
                        list.ecoid=ecoidUrl;
                        list.changetype=changetype;
                        var listString=JSON.stringify(list)
                        var index=getIndexof(datatListText1,listString);
                        if(index>(-1)){
                            index= parseInt(index)+1;
                            var nu=parseInt(i)+1;
                            if(list.view!="H10"){
                                sameTips+="新增物料第"+index+"行和第"+nu+"行数据重复;<br/>";
                            }
                        }
                        datatListText1.push(listString);
                        datatList1.push(list);

                    }else{
                        if(addCode==""&&num==""){

                        }else{
                            tips+="新增物料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                        }

                    }
                }
            }

            var side2=$("#side2 tbody tr");
            var datatList2=[];
            var datatListText2=[];
            for(var i=0;i<side2.length;i++){
                if($("#side2 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("删除物料存在异常数据，请重新编辑或删除异常数据，再进行提交")
                    datatList2=[];
                    return false ;
                }else if($("#side2 tbody tr").eq(i).attr("class")!="errTips"){
                    var partnumber=$("#side2 tbody tr").eq(i).find("td:nth-child(2) input").val();
                    var amount=$("#side2 tbody tr").eq(i).find("td:nth-child(4) input").val();
                    var linenumber=$("#side2 tbody tr").eq(i).find("td:nth-child(6) input").val();
                    var impac=$("#side2 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                    if(partnumber!=""&&amount!=""&&linenumber!=""&&impac!=""){
                        var list=impacSplit(impac);
                        list.partnumber=partnumber;
                        list.amount=amount;
                        list.linenumber=linenumber;
                        list.ecoid=ecoidUrl;
                        list.changetype=changetype;
                        var listString=JSON.stringify(list)
                        var index=getIndexof(datatListText2,listString);
                        if(index>(-1)){
                            index= parseInt(index)+1;
                            var nu=parseInt(i)+1;
                            if(list.view!="H10"){
                                sameTips+="删除物料第"+index+"行和第"+nu+"行数据重复;<br/>";
                            }
                        }
                        datatListText2.push(listString);
                        datatList2.push(list);
                    }else{
                        if(partnumber==""&&amount==""&&linenumber==""){

                        }else{
                            tips+="删除物料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                        }
                    }
                }

            }
            var side3=$("#side3 tbody tr");
            var datatList3=[];
            var datatListText3=[];
            for(var i=0;i<side3.length;i++){
                if($("#side3 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("替换物料存在异常数据，请重新编辑或删除异常数据，再进行提交")
                    datatList3=[];
                    return false ;
                }else if($("#side3 tbody tr").eq(i).attr("class")!="errTips"){
                    var side31=$("#side3 tbody tr").eq(i).find("td:nth-child(2) input").val();
                    var side32=$("#side3 tbody tr").eq(i).find("td:nth-child(4) input").val();
                    var side33=$("#side3 tbody tr").eq(i).find("td:nth-child(6) input").val();
                    var side34=$("#side3 tbody tr").eq(i).find("td:nth-child(7) input").val();
                    var side35=$("#side3 tbody tr").eq(i).find("td:nth-child(9) input").val();
                    var side36=$("#side3 tbody tr").eq(i).find("td:nth-child(11) input").val();
                    var impac=$("#side3 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                    if(side31!=""&&side32!=""&&side33!=""&&side34!=""&&side35!=""&&side36!=""&&impac!=""){
                        var list=impacSplit(impac);
                        list.oldnumber=side31;
                        list.oldamount=side32;
                        list.oldlinenumber=side33;
                        list.newnumber=side34;
                        list.newamount=side35;
                        list.newlinenumber=side36;
                        list.ecoid=ecoidUrl;
                        list.changetype=changetype;
                        var listString=JSON.stringify(list)
                        var index=getIndexof(datatListText3,listString);
                        if(index>(-1)){
                            index= parseInt(index)+1;
                            var nu=parseInt(i)+1;
                            if(list.view!="H10"){
                                sameTips+="替换物料第"+index+"行和第"+nu+"行数据重复;<br/>";
                            }
                        }
                        datatListText3.push(listString);
                        datatList3.push(list);

                    }else{
                        if(side31==""&&side32==""&&side33==""&&side34==""&&side35==""&&side36==""){

                        }else{
                            tips+="替换物料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                        }

                    }
                }

            }
            var side4=$("#side4 tbody tr");
            var datatList4=[];
            var datatListText4=[];
            for(var i=0;i<side4.length;i++){
                if($("#side4 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("用量修改存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList4=[];
                    return false ;
                }else if($("#side4 tbody tr").eq(i).attr("class")!="errTips"){
                var side41=$("#side4 tbody tr").eq(i).find("td:nth-child(2) input").val();
                var side42=$("#side4 tbody tr").eq(i).find("td:nth-child(4) input").val();
                var side43=$("#side4 tbody tr").eq(i).find("td:nth-child(6) input").val();
                var side44=$("#side4 tbody tr").eq(i).find("td:nth-child(7) input").val();
                var impac=$("#side4 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                if(side41!=""&&side42!=""&&side43!=""&&side44!=""&&impac!=""){
                    var list=impacSplit(impac);
                    list.oldnumber=side41;
                    list.oldamount=side42;
                    list.oldlinenumber=side43;
                    list.newamount=side44;
                    list.ecoid=ecoidUrl;
                    list.changetype=changetype;
                    var listString=JSON.stringify(list)
                    var index=getIndexof(datatListText4,listString);
                    if(index>(-1)){
                        index= parseInt(index)+1;
                        var nu=parseInt(i)+1;
                        if(list.view!="H10"){
                            sameTips+="用量修改第"+index+"行和第"+nu+"行数据重复;<br/>";
                        }
                    }
                    datatListText4.push(listString);
                    datatList4.push(list);
                }else{
                    if(side41==""&&side42==""&&side43==""&&side44==""){

                    }else{
                        tips+="用量修改信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                    }
                }}
            }

            var side5=$("#side5 tbody tr");
            var datatList5=[];
            var datatListText5=[];
            for(var i=0;i<side5.length;i++){
                if($("#side5 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("新增替代料存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList5=[];
                    return false ;
                }else if($("#side5 tbody tr").eq(i).attr("class")!="errTips"){
                var side51=$("#side5 tbody tr").eq(i).find("td:nth-child(2) input").val();
                var side52=$("#side5 tbody tr").eq(i).find("td:nth-child(4) input").val();
                var side53=$("#side5 tbody tr").eq(i).find("td:nth-child(5) input").val();
                var side54=$("#side5 tbody tr").eq(i).find("td:nth-child(7) input").val();
                var impac=$("#side5 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                if(side51!=""&&side52!=""&&side53!=""&&side54!=""&&impac!=""){
                    var list=impacSplit(impac);
                    list.numberA=side51;
                    list.linenumberA=side52;
                    list.numberB=side53;
                    list.amountB=side54;
                    list.ecoid=ecoidUrl;
                    list.changetype=changetype;
                    var listString=JSON.stringify(list)
                    var index=getIndexof(datatListText5,listString);
                    if(index>(-1)){
                        index= parseInt(index)+1;
                        var nu=parseInt(i)+1;
                        if(list.view!="H10"){
                            sameTips+="新增替代料第"+index+"行和第"+nu+"行数据重复;<br/>";
                        }
                    }
                    datatListText5.push(listString);
                    datatList5.push(list);
                }else{
                    if(side51==""&&side52==""&&side53==""&&side54==""){

                    }else{
                        tips+="新增替代料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                    }
                }}
            }
            var side6=$("#side6 tbody tr");
            var datatList6=[];
            var datatListText6=[];
            for(var i=0;i<side6.length;i++){
                if($("#side6 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("删除替代料存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList6=[];
                    return false ;
                }else  if($("#side6 tbody tr").eq(i).attr("class")!="errTips"){
                var side61=$("#side6 tbody tr").eq(i).find("td:nth-child(2) input").val();
                var side62=$("#side6 tbody tr").eq(i).find("td:nth-child(4) input").val();
                var side63=$("#side6 tbody tr").eq(i).find("td:nth-child(5) input").val();
                var impac=$("#side6 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                if(side61!=""&&side62!=""&&side63!=""&&impac!=""){
                    var list=impacSplit(impac);
                    list.numberA=side61;
                    list.linenumberA=side62;
                    list.numberB=side63;
                    list.ecoid=ecoidUrl;
                    list.changetype=changetype;
                    var listString=JSON.stringify(list)
                    var index=getIndexof(datatListText6,listString);
                    if(index>(-1)){
                        index= parseInt(index)+1;
                        var nu=parseInt(i)+1;
                        if(list.view!="H10"){
                            sameTips+="删除替代料第"+index+"行和第"+nu+"行数据重复;<br/>";
                        }
                    }
                    datatListText6.push(listString);
                    datatList6.push(list);
                }else{
                    if(side61==""&&side62==""&&side63==""){}
                    else{
                        tips+="删除替代料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                    }
                }}
            }

            var side7=$("#side7 tbody tr");
            var datatList7=[];
            var datatListText7=[];
            for(var i=0;i<side7.length;i++){
                if($("#side7 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("更换替代料存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList7=[];
                    return false ;
                }else if($("#side7 tbody tr").eq(i).attr("class")!="errTips"){
                var side71=$("#side7 tbody tr").eq(i).find("td:nth-child(2) input").val();
                var side72=$("#side7 tbody tr").eq(i).find("td:nth-child(4) input").val();
                var side73=$("#side7 tbody tr").eq(i).find("td:nth-child(5) input").val();
                var side74=$("#side7 tbody tr").eq(i).find("td:nth-child(7) input").val();
                var side75=$("#side7 tbody tr").eq(i).find("td:nth-child(9) input").val();
                var side76=$("#side7 tbody tr").eq(i).find("td:nth-child(11) input").val();
                var impac=$("#side7 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                if(side71!=""&&side72!=""&&side73!=""&&side74!=""&&side75!=""&&side76!=""&&impac!=""){
                    var list=impacSplit(impac);
                    list.partAnumber=side71;
                    list.partAlinenumber=side72;
                    list.oldpartnumber=side73;
                    list.oldpartamount=side74;
                    list.newpartnumber=side75;
                    list.newpartamount=side76;
                    list.ecoid=ecoidUrl;
                    list.changetype=changetype;
                    var listString=JSON.stringify(list)
                    var index=getIndexof(datatListText7,listString);
                    if(index>(-1)){
                        index= parseInt(index)+1;
                        var nu=parseInt(i)+1;
                        if(list.view!="H10"){
                            sameTips+="更换替代料第"+index+"行和第"+nu+"行数据重复;<br/>";
                        }
                    }
                    datatListText7.push(listString);
                    datatList7.push(list);
                }else{
                    if(side71==""&&side72==""&&side73==""&&side74==""&&side75==""&&side76==""){}
                    else{
                        tips+="更换替代料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                    }
                }}
            }
            var side8=$("#side8 tbody tr");
            var datatList8=[];
            var datatListText8=[];
            for(var i=0;i<side8.length;i++){
                if($("#side8 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("更换主料存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList8=[];
                    return false ;
                }else if($("#side8 tbody tr").eq(i).attr("class")!="errTips"){
                var side81=$("#side8 tbody tr").eq(i).find("td:nth-child(2) input").val();
                var side82=$("#side8 tbody tr").eq(i).find("td:nth-child(4) input").val();
                var side83=$("#side8 tbody tr").eq(i).find("td:nth-child(5) input").val();
                var side84=$("#side8 tbody tr").eq(i).find("td:nth-child(7) input").val();
                var side85=$("#side8 tbody tr").eq(i).find("td:nth-child(9) input").val();
                var impac=$("#side8 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                if(side81!=""&&side82!=""&&side83!=""&&side84!=""&&side85!=""&&impac!=""){
                    var list=impacSplit(impac);
                    list.oldpartnumber=side81;
                    list.oldpartlinenumber=side82;
                    list.oldpartamount=side83;
                    list.newpartnumber=side84;
                    list.newpartamount=side85;
                    list.ecoid=ecoidUrl;
                    list.changetype=changetype;
                    var listString=JSON.stringify(list)
                    var index=getIndexof(datatListText8,listString);
                    if(index>(-1)){
                        index= parseInt(index)+1;
                        var nu=parseInt(i)+1;
                        if(list.view!="H10"){
                            sameTips+="更换主料第"+index+"行和第"+nu+"行数据重复;<br/>";
                        }
                    }
                    datatListText8.push(listString);
                    datatList8.push(list);
                }else{
                    if(side81==""&&side82==""&&side83==""&&side84==""&&side85==""){}
                    else{
                        tips+="更换主料信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                    }
                }}
            }
            var side9=$("#side9 tbody tr");
            var datatList9=[];
            var datatListText9=[];
            for(var i=0;i<side9.length;i++){
                if($("#side9 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("主次替换存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList9=[];
                    return false ;
                }else if($("#side9 tbody tr").eq(i).attr("class")!="errTips"){
                var side91=$("#side9 tbody tr").eq(i).find("td:nth-child(2) input").val();
                var side92=$("#side9 tbody tr").eq(i).find("td:nth-child(5) input").val();
               var side93=$("#side9 tbody tr").eq(i).find("td:nth-child(4) input").val();
                var impac=$("#side9 tbody tr").eq(i).find("td:nth-last-child(2) input").val();
                if(side91!=""&&side92!=""/*&&side93!=""*/&&impac!=""){
                    var list=impacSplit(impac);
                    list.partANumber=side91;
                    list.linenumber=side93;
                    list.partBNumber=side92;
                    list.changetype=changetype;
                    list.ecoid=ecoidUrl;
                    var listString=JSON.stringify(list)
                    var index=getIndexof(datatListText9,listString);
                    if(index>(-1)){
                        index= parseInt(index)+1;
                        var nu=parseInt(i)+1;
                        if(list.view!="H10"){
                            sameTips+="主次替换第"+index+"行和第"+nu+"行数据重复;<br/>";
                        }
                    }
                    datatListText9.push(listString);
                    datatList9.push(list);
                }else{
                    if(side91==""&&side92==""){

                    } else{
                        tips+="主次替换信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
                    }
                }}
            }
			//add by xucr on 20210125 添加替代料用量修改 begin
			var side10=$("#side10 tbody tr");
            var datatList10=[];
            var datatListText10=[];
			for(var i=0;i<side10.length;i++){
                if($("#side10 tbody tr").eq(i).attr("class")=="errTips"){
                    layerFn("替料用量存在异常数据，请重新编辑或删除异常数据，再进行提交");
                    datatList10=[];
                    return false ;
                } else if ($("#side10 tbody tr").eq(i).attr("class")!="errTips"){
					var side101=$("#side10 tbody tr").eq(i).find("td:nth-child(2) input").val(); //主料
					var side102=$("#side10 tbody tr").eq(i).find("td:nth-child(4) input").val(); //替料
					var side103=$("#side10 tbody tr").eq(i).find("td:nth-child(8) input").val(); //变更后用量
					var side104=$("#side10 tbody tr").eq(i).find("td:nth-child(6) input").val(); //变更前用量
					var side105=$("#side10 tbody tr").eq(i).find("td:nth-child(3) input").val(); //行号
					var impac=$("#side10 tbody tr").eq(i).find("td:nth-last-child(2) input").val(); //受影响对象
					if(side101!=""&&side102!=""&&side103!=""&&impac!=""){
						var list=impacSplit(impac);
						list.mainNum=side101;
						list.mainLineNumber="";
						list.oldNum=side102;
						list.oldAmount=side104;
						list.newAmount=side103;
						list.changetype=changetype;
						list.mainLineNumber=side105;
						list.ecoid=ecoidUrl;
						var listString=JSON.stringify(list)
						var index=getIndexof(datatListText10,listString);
						if(index>(-1)){
							index= parseInt(index)+1;
							var nu=parseInt(i)+1;
							if(list.view!="H10"){
								sameTips+="替料用量第"+index+"行和第"+nu+"行数据重复;<br/>";
							}
						}
						datatListText10.push(listString);
						datatList10.push(list);
					}else{
						if(side101==""&&side102==""&&side103==""){
						} else{
							tips+="提料用量信息填写不完整，请重新编辑或删除异常数据，再进行提交。";
						}
					}
				}
            }
			//add by xucr on 20210125 添加替代料用量修改 end
			
            if(sameTips!=""){
                layerFn(sameTips+"请重新编辑或删除重复数据，再进行提交。");
                return;
            }else if(tips==""){
                submitSide1(datatList1);
                $("#loading").css({
                    display:"block"
                });
                function submitSide1(datatList1){
                    if(datatList1.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList1
                        }
                        ajaxNewFn("/ECOChange/tmAddNum",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                                return ;
                            }else{
                                submitSide2(datatList2);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide2(datatList2);
                    }
                }

                function submitSide2(datatList){

                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/tmdelete",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                                return ;
                            }else{
                                submitSide3(datatList3);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide3(datatList3);
                    }
                }

                function submitSide3(datatlist){

                    if(datatlist.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatlist
                        }
                        ajaxNewFn("/ECOChange/tmReplaceSubmit",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                                return;
                            }else{
                                submitSide4(datatList4);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide4(datatList4);
                    }
                }
                function submitSide4(datatList){

                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/dosModific",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                                return;
                            }else{
                                submitSide5(datatList5);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide5(datatList5);
                    }
                }
                function submitSide5(datatList){

                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/addReplacePart",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                                return;
                            }else{
                                submitSide6(datatList6);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide6(datatList6);
                    }
                }
                function submitSide6(datatList){
                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/deleteReplacePart",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                                return;
                            }else{
                                submitSide7(datatList7);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide7(datatList7);
                    }
                }

                function submitSide7(datatList){

                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/replaceOldPart",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                            }else{
                                submitSide8(datatList8);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide8(datatList8);
                    }
                }
                function submitSide8(datatList){

                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/repalcePartA",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);

                            }else{
                                submitSide9(datatList9);
                            }
                        },function(err){

                        })
                    }else{
                        submitSide9(datatList9);
                    }
                }
                function submitSide9(datatList){

                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/repalcePartAAndPartB",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn(result.result);
                            }else{
                                $("#loading").css({
                                    display:"none"
                                });
                                layerFn("提交成功",function(){
                                    if(urlData=="true"){
                                        window.open("search.html?oid="+ecoidUrl)
                                    }
                                    window.location.href="about:blank";
                                    window.opener=null;
                                    window.open('','_self');
                                    window.close();
                                });

                            }
                        },function(err){

                        })
                    }else{
                        /**if(datatList1.length>0||datatList2.length>0||datatList3.length>0||datatList4.length>0||datatList5.length>0||datatList6.length>0||datatList7.length>0||datatList8.length>0||datatList9.length>0){
                            layerFn("提交成功",function(){
                                if(urlData=="true"){
                                    window.open("search.html?oid="+ecoidUrl)
                                }
                                window.location.href="about:blank";
                                window.opener=null;
                                window.open('','_self');
                                window.close();
                            });
                        }else{
                            layerFn("您提交的数据为空，请填写数据后再进行提交")
                        }*/
						//modify by xucr on 20210125 按照此方法的格式修改
						submitSide10(datatList10);
                    }
                }
				
				//add by xucr on 20210125 替代料用量修改提交
				function submitSide10(datatList){
                    if(datatList.length>0){
                        var data={
                            ecoid:getQueryStringByNameTwo("oid"),
                            effectnumber:getQueryStringByNameTwo("single")=="true"?getQueryStringByNameTwo("num"):"",
                            type:getQueryStringByNameTwo("single")=="true"?0:1,
                            datalist:datatList
                        }
                        ajaxNewFn("/ECOChange/addSubstitutesQuantity",data,function(result){
                            if(result.result!=""){
                                $("#loading").css({display:"none"});
                                layerFn(result.result);
                            }else{
                                $("#loading").css({display:"none"});
                                layerFn("提交成功",function(){
                                    if(urlData=="true"){
                                        window.open("search.html?oid="+ecoidUrl)
                                    }
                                    window.location.href="about:blank";
                                    window.opener=null;
                                    window.open('','_self');
                                    window.close();
                                });

                            }
                        },function(err){

                        })
                    }else{
                        if(datatList1.length>0||datatList2.length>0||datatList3.length>0||datatList4.length>0||datatList5.length>0||datatList6.length>0||datatList7.length>0||datatList8.length>0||datatList9.length>0){
                            layerFn("提交成功",function(){
                                if(urlData=="true"){
                                    window.open("search.html?oid="+ecoidUrl)
                                }
                                window.location.href="about:blank";
                                window.opener=null;
                                window.open('','_self');
                                window.close();
                            });
                        }else{
                            layerFn("您提交的数据为空，请填写数据后再进行提交")
                        }
                    }
                }

            }else{
                layerFn(tips)
            }

        })

    }
</script>
</body>
</html>